wolfv
April 24, 2016, 1:37pm
1
I want to add my library to Library Manager as described in Library Manager FAQ · arduino/Arduino Wiki · GitHub
The Arduino IDE 1.5: Library specification says
For 1.5.x-only libraries, the source code resides in the src folder.
Quote is from Arduino IDE 1.5: Library specification · arduino/Arduino Wiki · GitHub
I am using Arduino 1.6.7. Where should the source reside for Arduino 1.6.x?
pert
April 24, 2016, 5:59pm
2
That should say 1.5.x+. I have edited the file to fix this. So you can put your source code files in the src subfolder of your library folder if you want. The disadvantage of this is that it makes your library incompatible with Arduino IDE 1.0.x. Don't think of what IDE version you're using, think of what versions you want the users of your library to be able to use. How much backwards compatibility you want to provide is up to you(assuming the library doesn't rely on features unavailable in 1.0.x). Obviously anyone installing the library with Library Manager with be using 1.6.x but others may download your library from GitHub and manually install it. I know there are still some holdouts who have still refused to upgrade past 1.0.5 or 1.0.6.
If you want to post a link to your library before submitting it I'd be happy to take a quick look at it to see if I can spot any issues preventing it from being Library Manager compatible. It seems like around 30% of the libraries submitted have some issue which prevents initial acceptance and this takes up time the developer could be spending fixing bugs instead.
wolfv
April 24, 2016, 7:52pm
3
Thanks pert
My example does not seem to be compiling with source files in the src directory
example0.ino compiles nicely when the directory is structured like so:
Arduino/libraries/myLib/
examples/example0/example0.ino
Cd.h
But example0.ino does not compile when the Cd.h file is moved to scr folder, and the directory is structured like this:
Arduino/libraries/myLib/
examples/example0/example0.ino
scr/Cd.h
Error message:
Arduino: 1.6.7 (Linux), TD: 1.27, Board: "Teensy 2.0, Serial, 16 MHz, US English"
/opt/arduino-1.6.7/arduino-builder -dump-prefs -logger=machine -hardware "/opt/arduino-1.6.7/hardware" -tools "/opt/arduino-1.6.7/tools-builder" -tools "/opt/arduino-1.6.7/hardware/tools/avr" -built-in-libraries "/opt/arduino-1.6.7/libraries" -libraries "/home/wolfv/Documents/Arduino/libraries" -fqbn=teensy:avr:teensy2:usb=serial,speed=16,keys=en-us -ide-version=10607 -build-path "/tmp/build4cbf02a3913d44962c181b954d352358.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "/home/wolfv/Documents/Arduino/libraries/myLib/examples0/example0/example0.ino"
/opt/arduino-1.6.7/arduino-builder -compile -logger=machine -hardware "/opt/arduino-1.6.7/hardware" -tools "/opt/arduino-1.6.7/tools-builder" -tools "/opt/arduino-1.6.7/hardware/tools/avr" -built-in-libraries "/opt/arduino-1.6.7/libraries" -libraries "/home/wolfv/Documents/Arduino/libraries" -fqbn=teensy:avr:teensy2:usb=serial,speed=16,keys=en-us -ide-version=10607 -build-path "/tmp/build4cbf02a3913d44962c181b954d352358.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "/home/wolfv/Documents/Arduino/libraries/myLib/examples0/example0/example0.ino"
"/opt/arduino-1.6.7/hardware/tools/avr/../avr/bin/avr-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -fno-exceptions -felide-constructors -std=c++0x -mmcu=atmega32u4 -DTEENSYDUINO=127 -DARDUINO=10607 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-I/opt/arduino-1.6.7/hardware/teensy/avr/cores/teensy" "/tmp/build4cbf02a3913d44962c181b954d352358.tmp/sketch/example0.ino.cpp" -o "/dev/null"
"/opt/arduino-1.6.7/hardware/tools/avr/../avr/bin/avr-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -fno-exceptions -felide-constructors -std=c++0x -mmcu=atmega32u4 -DTEENSYDUINO=127 -DARDUINO=10607 -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-I/opt/arduino-1.6.7/hardware/teensy/avr/cores/teensy" "/tmp/build4cbf02a3913d44962c181b954d352358.tmp/sketch/example0.ino.cpp" -o "/tmp/build4cbf02a3913d44962c181b954d352358.tmp/preproc/ctags_target_for_gcc_minus_e.cpp"
/home/wolfv/Documents/Arduino/libraries/myLib/examples0/example0/example0.ino:1:16: fatal error: Cd.h: No such file or directory
#include <Cd.h>
^
compilation terminated.
exit status 1
Error compiling.
Arduino/libraries/myLib/examples/example0/example0.ino:
#include <Cd.h>
Cd d;
void setup() { }
void loop() { }
Arduino/libraries/myLib/scr/Cd.h:
#ifndef CD_H
#define CD_H
#include <Arduino.h>
class Cd
{
public:
void print() { Serial.println("in Cd"); }
};
#endif
I am using Arduino 1.6.7 with Teensyduino 1.27
And get same error with Tools > Board: "Arduino Leonardo"
pert
April 24, 2016, 9:52pm
4
Do you have a library.properties file?
wolfv
April 24, 2016, 10:06pm
5
Good idea.
But still get the same error after copy and pasted the library.properties example file from Arduino IDE 1.5: Library specification · arduino/Arduino Wiki · GitHub
What else can I check?
pert
April 24, 2016, 10:15pm
6
You need to restart the Arduino IDE after adding the
wolfv:
scr/Cd.h
The folder should be named src, not scr.
wolfv
April 24, 2016, 10:53pm
7
That fixed it! Thank you so much for solving a problem of my own making.