You can erase any parts of this template not applicable to your Issue.
Ubuntu 17.04 system:
3.6.2a2
|-- Projectfolder
|-- include
|-- README
|-- lib
|-- lib1
|-- src
|-- lib1.h
|-- lib1.cpp
|-- lib2
|-- src
|-- lib2.h
|-- lib2.cpp
|-- src
|-- main.cpp
|-- platformio.ini
code of lib1.h:
void func1();
code of lib1.cpp:
void func1(){
//doanythinghere
}
code of lib2.h:
void func2();
code of lib2.cpp:
#include <lib1.h>
void func2(){
func1();
}
code of main.cpp
#include <lib2.h>
void setup(){
}
void loop(){
func2();
}
BUT: As soon I am renaming
lib1 -> config
lib1.h -> config.h
lib1.cpp -> config.cpp
I get an Compile Error:
lib/lib2/src/lib2.cpp:4:11: error: 'func1' was not declared in this scope
If for any reason this is not a bug but a feature, it should be mentioned in the Readme, i spent almost a day on finding out that the problem is the name of the lib...
The content of platformio.ini:
[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
Did you rename #include <lib1.h> in lib2.cpp:?
Did you rename
#include <lib1.h>inlib2.cpp:?
Of course!
Please provide archive with a simple project to reproduce this issue. Thanks!
you can find it on my github account: https://github.com/atsteich/pub
has anybody been able to reproduce?
Sorry for delay. Please upgrade PIO Core to the latest dev version via pio upgrade --dev. Does it work now?
The issue was linked with duplicated config.h in Arduino framework which was in the first order in CPPPATH. Nevertheless, this is a bug, user's custom includes, project includes, and library dependencies should go first in list for C Preprocessor.
after upgrading everything works as expected, thanks!
Sorry to resurrect an old issue, but it seems commit b22ca10 has broken my builds. I have a project where my platformio.ini has something like
[platformio]
include_dir = ./foo_lib
...
[env:...]
...
lib_deps =
bar_lib
...
Prior to b22ca10, the build command would effectively end up with -I./foo_lib before -I./.piolibdeps/bar_lib/ which worked. After this patch, the order is flipped, which I guess was the intent?
Unfortunately I have a .h file with the same name in both foo_lib and bar_lib, and it would be very difficult to resolve the name conflict cleanly. I need the version in foo_lib, not in the thirdparty bar_lib for compiling my code.
I'm a bit confused because if anything, the changes that were made to close this issue seem like they would have ensured that whatever I specified with include_dir would have ended up first, but this does not seem to be the case. Regardless, how do I ensure that -I./foo_lib comes early in the build flags?
@nstiurca thank you so much for the report! Please re-test with pio upgrade --dev.
That fixed it for me, thanks for the quick turnaround!