Local toolchain on Windows - how to manage adding new library files?

I have set up the local toolchain on Windows 7 and it works fine for compiling and flashing the core when the application.cpp file doesn’t have any #includes (besides application.h).

Now I am trying to use the Adafruit libraries that pkournay kindly ported but I am new enough to c++ compiling that I am not sure where to place the library .cpp and .h files. I have tried putting the .cpp files in /src and the .h in /inc and I believe I have the proper #includes but I am getting the following:

obj/src/application.o: In function 'setup': C:\Spark\core-firmware\build/../src/application.cpp:40: undefined reference to 'Adafruit_SSD1306::begin(unsigned char, unsigned char)' C:\Spark\core-firmware\build/../src/application.cpp:41: undefined reference to 'Adafruit_SSD1306::display()' C:\Spark\core-firmware\build/../src/application.cpp:44: undefined reference to 'Adafruit_SSD1306::clearDisplay()' C:\Spark\core-firmware\build/../src/application.cpp:45: undefined reference to 'Adafruit_GFX::setTextSize(unsigned char)' C:\Spark\core-firmware\build/../src/application.cpp:46: undefined reference to 'Adafruit_GFX::setTextColor(unsigned short)' obj/src/application.o: In function '__static_initialization_and_destruction_0': C:\Spark\core-firmware\build/../src/application.cpp:7: undefined reference to 'Adafruit_SSD1306::Adafruit_SSD1306(signed char)' collect2.exe: error: ld returned 1 exit status make: *** [core-firmware.elf] Error 1

I have played around with the #includes and the #ifndef statements to no avail although I can produce other error messages. The same files compile in the Web IDE without a problem, I am trying to use the local toolchain to use the core-firmware that improves RAM usage.

Apologizing if this is obvious, but can anyone clarify what the additional #includes should be when incorporating library files (and where the files should be located) for application.cpp, application.h and the additional .h and .cpp library files. Any pointers would be much appreciated.

And the answer is that it appears that you have to manually add the files to the build.mk file that is located in the /core-firmware/src directory. Once I added the Adafruit files to the end of the list of .cpp files, it compiled andm in addition, the new firmware files enabled the program to run without running out of heap memory. Very cool.

1 Like