I’ve created a Libary called “filemanager” it’s including the ArduinoJson Libary (installed with the inbuild Libary Manager).
this libary is included in a lot of other libarys within my project, every time it compiled without errors but if i want to include the filemanager Libary in my “new” Libary and i want to compile PlatformIO can’t find the installed ArduinoJSON Libary but at the right beginning of the compilation it mark ArduinoJSON as installed… if I comment out the include statement it compiles without errors again and find the ArduinoJSON libary needed by the filemanager…
I removed the .vscode and .pio folder, reinstall vsCode and pio but this can’t fix it…
I can’t manage this problem with google because i can’t find a problem like this
Hope anyone knows a solution…
I’m glad if anyone can check my File maybe i’ve not included it correctly?
Consider creating a library.json file for your library in which you declare your ArduinoJson dependency (docs)
Have you tried different values for the lib_ldf_mode in the platformio.ini?
All library declarations in
are of the old style / type since they don’t contain the owner or version information. See docs and example
4. Your referenced repo builds correctly for me by just cloning and pio run-ing it
5. Have you tried upgrading the PIO core version by open the CLI and doing pio ugprade --dev, then restarting VSCode?
6. What’s the full build log you get when you compile it and there’s an error?
Point 1 and 3: I didn’t know that this way is the “old Style” - i definitely use your shown way in the future - thanks for that
Point 2: no i didn’t try that, i thougt thats only for my own Liabries ^^ - i’ll try it
Point 4: Yes, the Files i’ve referenced are correct (the branch dev_linear_web is correct)
Link: GitHub - j54j6/ESPBase at dev_linearWeb
I’ve downloaded it to test and it end’s with an error (log is linked below)
Point 5: Now i’ve upgraded my PIO but this doesn’t fix it for me
But i found out if i include all Libarys needed by the filemanager.h in my logger.h it will work without problems… (first i included ArduinoJson in the logger.h but then Platformio can’t find SPI.h, after including this it can’t find LittleFS…) - i don’t understand this problem… - is this helpful?
Due to surrounding the #include with a macro / #ifdef
and the default LDF mode, the dependencies are not picked up properly, since macros are not evaluated (see original documentation link I posted). I get the same error as you in the branch you’ve mentioned.
Once can also see that dependencies are missing in the dependency graph
and then reveal a programming mistake in the library
In file included from lib\logging\src\logger.cpp:1:0:
lib\logging\src\logger.h:39:18: error: expected unqualified-id before numeric constant
#define logLevel 7
^
lib\logging\src/logging.h:15:13: note: in expansion of macro 'logLevel'
int logLevel = -1;
^
In file included from lib\filemanager\src/filemanager.h:7:0,
from lib\logging\src\logger.h:63,
from lib\logging\src\logger.cpp:1:
lib\logging\src/logging.h: In static member function 'static int logger::getLogLevel()':
l
you’ve named a variable and a macro the same way.
Again the LDF mode and the dependencies can all be set in the library.json file too if you decide to create one for your library.
If I change logLevel to m_logLevel in the logging.h (2 occurrences), the result is
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [====== ] 58.3% (used 47796 bytes from 81920 bytes)
Flash: [==== ] 39.4% (used 412040 bytes from 1044464 bytes)
============== [SUCCESS] Took 39.01 seconds ==============
Thank you so much for your help, the lib_ldf_mode solves my problem ^^ - The other is because of my deprecated Libary “logging.h” this libary will be replaced by the logger.h Lib - i fixed this only local to keep the data the same as at the beginning of this topic ^^ - but thanks a lot for your help
I think i need to read the PIO Documentation to prevent fails like that in the future ^^