I am working on an Arduino project with a friend and we need 2 external libraries, OneWire and DallasTemperature. I can easily install them on my computer and it will work completely fine, but I actually want to install them in my git folder, so anyone can instantly use my code. My folder structure is as follows:
project_folder/
> libraries/
> OneWire/
> OneWire.h and OneWire.cpp and so
> DallasTemperature/
> DallasTemperature.h and DallasTemperature.cpp and so
> project.ino
In the header files I had to change some references, mostly file paths, so #include <OneWire.h> became #include "../OneWire/OneWire.h" and so and and I got no errors there. In my project.ino I loaded both libraries using #include "libraries/OneWire/OneWire.h" and #include "libraries/DallasTemperature/DallasTemperature.h", which all seem to work, but when I verify my code I get the following error:
C:\Users\<my username>\AppData\Local\Temp\ccZFsuFb.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_project.ino.cpp.o.1999':
<artificial>:(.text.startup+0x5e): undefined reference to `OneWire::begin(unsigned char)'
<artificial>:(.text.startup+0x6a): undefined reference to `DallasTemperature::DallasTemperature(OneWire*)'
C:\Users\<my username>\AppData\Local\Temp\ccZFsuFb.ltrans0.ltrans.o: In function `setup':
C:\Users\<my username>\Documents\<project folder>/project.ino:13: undefined reference to `DallasTemperature::begin()'
C:\Users\<my username>\AppData\Local\Temp\ccZFsuFb.ltrans0.ltrans.o: In function `loop':
C:\Users\<my username>\Documents\<project folder>/project.ino:17: undefined reference to `DallasTemperature::requestTemperatures()'
C:\Users\<my username>\Documents\<project folder>/project.ino:19: undefined reference to `DallasTemperature::getTempCByIndex(unsigned char)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.
Is there a possibility to install these libraries in my project folder or do I really have to install them seperately on each system?
gitfor object files is really not a good idea. You'll need to push those every time you compile and all versions of them will be there. Cloning that repo after 10000 compilations will be a real pain. Use some cloud service for the object files and use git for the source code.OneWire::begin(unsigned char)defined in OneWire.cpp (for example), or are there additional files that have not been compiled/linked? Switch on "Show verbose output" and add the full log to your question so we can see what the build system is actually doing."src"rather than"libraries", but I don't think that is necessary - just a convention, or possibly Cargo Cult programming.