3

I make my own library for arduino.

The file structure is like below.

AAA - README.md
 - examples - A - A.ino
 - B - B.ino
 - AAA.h
 - BBB.h
 - CCC.h
 - BBB.cpp
 - CCC.cpp

It works well. But I want to grouping a library source files like below.

AAA - same as above
 - src - AAA.h
 - BBB.h
 - CCC.h
 - BBB.cpp
 - CCC.cpp

It doesn't work at all.

Arduino IDE shows the message

Specified folder/zip file does not contain a valid library.

But, WiFi101 library was made by src folder. Why isn't it possible for mine?

asked Feb 7, 2017 at 1:20

1 Answer 1

2

I'm going to assume your library structure is like this because the structure you described above would not cause that error:

AAA
|_src
 |_AAA.h
 |_BBB.h
 |_CCC.h
 |_BBB.cpp
 |_CCC.cpp

To be considered valid by the Arduino IDE, a library must either have a .h file in the root folder or a library.properties file if you are using the 1.5 library format. Putting all the source files in the src subfolder means your library is in the 1.5 library format. So you need to add a library.properties file in the root of the library formatted as described here: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format. Then your library should look like this:

AAA
|_library.properties
|_src
 |_AAA.h
 |_BBB.h
 |_CCC.h
 |_BBB.cpp
 |_CCC.cpp
answered Feb 7, 2017 at 2:13
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.