Including "global" Header File to private Libraries

I have written some private libraries (each has one .h and one .cpp file) , and placed them in the lib folder, in the way it is suggested in the README. So far everything works fine, i can include all the headers without compiling errors.

Now, the tricky part: in each of this libraries i need to access to variables specified in another (global) config.h, in which i have specified for example the used Pins of my chip. When i include this config.h (that is also placed in the lib folder) in the libraries, i can’t use the defined values, although I have included the config.h file…

WHY?! and how to get around this?? I simply get the error that the variables are not defined in this scope…

I have no idea what the problem is here, and would be thankful for some help!

Please upload a minimal example to demonstrate the error.

i can’t upload the folder structure here, but i have copied a sample project to Dropbox

I found a solution: It seems like the name “config” is the problem. as soon I rename config.h to any other name, everything works as expected…

That’s interesting. I think I have the same problem in one of my other projects…

Did renaming solved the problem for you too? I opened a bug report on subfolder of lib mustn't be named *config* · Issue #1914 · platformio/platformio-core · GitHub

I reconfigured that project to get around using a config.h using defs in the platform.ini defs. I was scratching my head over this one for some time. I just never mad the connection you did.

I will create a new project later to confirm.

I also just found the “solution” , because i was creating a sample project for the bug report, (with names lib1 and lib2) and suddenly everything worked fine :rofl:

This is a bug, fixed in