How to create library examples with *.h include files?

I want to make a library (v2) of a library where the example includes *.h file.
Partivle Dev and CLI can’t compile it.
Uploaded to webIDE as a private library but it lists “usage” and “data.h” as seperate example files.

I used particle library create to populate the initial structure:



Can you try this command from the libraries “root” directory

particle compile photon examples/usage

What’s the output?

@ScruffR Thanks for the suggestion. Here’s the output:

C:\Users\doan\tech\tcon_mpico>particle compile p examples/usage

Compiling code for p

attempting to compile firmware
Compile failed. Exiting.
usage.cpp:3:24: fatal error: tcon_mpico.h: No such file or directory
// Example usage for mpico library by Michael Doan.

compilation terminated.
make[1]: *** […/build/target/user/platform-6usage.o] Error 1
make: *** [user] Error 2

I can compile the hello_world.h directly.

C:\Users\doan\tech\tcon_mpico>particle compile p examples/usage/hello_world.h

Compiling code for p

attempting to compile firmware
downloading binary from: /v1/binaries/58cd547dffa8bc3235f51a4e
saving to: p_firmware_1489851510651.bin
Memory use:
text data bss dec hex filename
4476 8 1424 5908 1714
Compile succeeded.

I can’t do the same for usage.ino because it doesn’t find hello_world.h. Putting both files in the compile command line results in the same fail signature as the first attempt in this experiment.

What does work is if I move hello_world.h to the SRC directory. However, that doesn’t seem ideal since I’d want library users to load their own data file and not have to carry this example around with their code.

I have already proposed the addition of a file for library examples to allow for more complex samples a while back.
And @jvanier said to consider it, but can’t promise anything let alone give a timeline.