Hello comunity members,
in my platformio.ini file I have the enteries:
build_flags =
-I"$PROJECT_INCLUDE_DIR"
-I C:/Users/private/Documents/PlatformIO/ESP32/Projects/myLibs
…
The structure of my project directories is:
-PROJECTDIR
-.pio
-.vscode
-\include
–gps.h
–main.h
-\lib
–README
-\src
–main.cpp
–gps.cpp
-\test
-platformio.ini
The path “-I C:/Users/private/Documents/PlatformIO/ESP32/Projects/myLibs”
points to a directory where a collection of subdirectories contain different files. One of these directories is “my_GPS”. In this directory there are two files.
Here’s the complete path:
C:/Users/private/Documents/PlatformIO/ESP32/Projects/myLibs
/my_GBS
–/GPS_func.h
–/gps.h
So there are 2 files named gps.h with differnt content in different paths.
When I use: #include “gps.h” in the file gps.cpp it includes the file from the path C:/Users/private/Documents/PlatformIO/ESP32/Projects/myLibs\my_GPS
and when I use #include “…/include/gps.h” in the file gps.cpp it includes the file of the include-path of the project.
My quiestion: what are the criterias the compiler or liker use to decide which path to use for files in different directories having equal names. I expected that the header files are used depending of the directories they are or is my entery of “$PROJECT_INCLUDE_DIR” invalid?
Looking forward to a detailed answer.
Heinz