PlatformIO Community

Include Path Problems

Hi,
I have include path problems with the library that I have just published.

I developed my library in the lib folder without problem but after the publication, the library being then in the pio/libdeps folder I had the following problems:

  1. my library is not recognized in my main.cpp file. Solved by moving my headers files from src to an include folder (according to the documentation).

  2. after solving the first problem, the second is related to the #include <EEPROM.h> in my .cpp files, should I declare these includes only in the .h files? If so, do you have any advice on how I should link my files together?

Link to library.

Thank you in advance for your help.

Best regards,

GogoVega.

If you don’t specify anything else in the library.json, PlatformIO will add only the src/ and include/ (not present in your case) folders to the include paths on the top level, not recursively. You have created a nested folder structure though with your

grafik

And so the example would actually have to do #include <RFIDtoEEPROM/RFIDtoEEPROM.h> to include the nested header.

You can solve this problem by adding -Isrc/RFIDtoEEPROM, -Isrc/Card, -Isrc/Code, -Isrc/StreamDebug build flag instructions to the libary.json as documented.

1 Like

See https://github.com/GogoVega/RFIDtoEEPROM/pull/3 for concrete + tested fix.

1 Like

Thanks a lot.
So with these changes, everything should work normally (without changing the location of the headers)?

There is no need for guessing or “should work” words – just add CI to github and tell PlatformIO to compile for every platform you declare your library to be compatible with in the library.json and see if compilation of the example code goes through. PlatformIO will tell you the whether it worked or not.

As you can see in Update build.yml · maxgerhardt/RFIDtoEEPROM@ad05c2c · GitHub, CI shows that only the Pico has problems compiling

Environment    Status    Duration
-------------  --------  ------------
uno            SUCCESS   00:00:03.927
nano_every     SUCCESS   00:00:01.885
esp32dev       SUCCESS   00:00:11.957
nodemcuv2      SUCCESS   00:00:17.588
pico           FAILED    00:00:01.524
Compiling .pio/build/pico/lib986/SPI/SPI.cpp.o
/tmp/tmpcqlf8afo/src/mfrc522_example.ino:46:1: error: 'RFIDtoEEPROM' does not name a type; did you mean 'RFIDtoEEPROM_h'?
   46 | RFIDtoEEPROM myCard(NUMBYTES);
      | ^~~~~~~~~~~~
      | RFIDtoEEPROM_h

I’m not yet sure why, need to investigate.

The main library class is not defined for a Pico?

No, because Pico has no internal EEPROM, there are functions to read/write its memory but I still have to investigate

1 Like

Is this change considered a new version (1.0.1)?
If not, is it possible to delete version 1.1.0 in order to republish it @ivankravets.
Thank you @maxgerhardt for your help :smiley:

It definitely won’t build in PlatformIO without the include path changes, so there should be a new release. Usually developers themselve can only pio package unpublish their library after a time limit (maybe 1 or 2 days?), so if you try that and that does not work, your options are either a new release or just have Ivan remove the non-working release.

See pio package unpublish --help on the CLI.

I can unpublish my release but I can’t overwrite it, for that Ivan has to delete it.

Please re-publish your package.

Updated and problem solved :smiling_face_with_tear:.
Thank you @maxgerhardt and @ivankravets for your help :smiley:.

Best Regards,

GogoVega.

1 Like