Ive been having the “No such file or directory” issue for quite some time in PlatformIO extension with VScode when its never been an issue in Visual Studio. (not VScode)
I require a config file to be included in several libraries and other sources. My project setup is as follows:
MyProject
|-include
| |-config.h
|-lib
| |-LibraryA
| | |-libraryA.h
| | |-libraryA.cpp
| |-LibraryB
| | |-libraryB.h
| | |-libraryB.cpp
|-src
| |-main.cpp
Now, if I include config.h in main.cpp all is well. But if I include config.cpp in LibraryA/B.h or LibraryA/B.cpp I get the “No such file or directory” compiling error.
Why is this? If I right click #include "config.h"
and select “Go to References” it takes me to the config file, or I can “Tab” autocomplete when typing in config.h it does so successfully too. So it knows the header file exists. Why can the linker not find it?
Is there a way to change the include statement to navigate from one library directory, such as LibraryA.cpp to something like #include “MyProject/include/config.h”?
Any help would be greatly appreciated.
Thank you