Lib_deps creating different versions of included file?

I have several similar projects in the same env type: “Generic” project contains .h files that I use in all my other application-specific projects. I have put lib_deps in each project’s platformio.ini to point to the “Generic” project include directory.

If I open a source .c file in one of my application projects, the #include directives are shown without error. If I right-click on one of them, I can then click on “Go to Definition” which will open the included file for editing. If I edit it, the edits will persist every time I open that source .c file, but the original version in the “Generic” project and all other projects is unchanged.

When I look at the individual project include directories in the EXPLORER window on the left of the screen, they are empty, except for the “Generic” project which contains all my unedited include files.

Where are my edits stored??? , and

Is there a way to edit the ‘Generic’ include files from any open project and have the changes reflected in all other projects?

If I have understood your description correctly, the main problem is the wrong approach, namely the use of global libraries. This may be an approach from the ArduinoIDE. However, PlatformIO pursues a different goal, namely the reproducibility of projects with exact framework and library versions.

Please tell or show exactly what problem you want to solve and what you want to achieve. If you are working with multiple projects, please also show the file structure you are using.

I see my problem now:

In my EXPLORER window, 3 projects:


V generic
  V include
    C someInclude.h
  V src
    C skeleton.c
V appA
  V include
      README
  V src
    C appA.c
V appB
  V include
      README
  V src
    C appB.c

The platformio.ini file for projects appA and appB have a “lib_deps=” line pointing to the
PlatformIO/generic/include directory.

I found the edited someInclude.h file in PlatformIO/appA/.pio/libdeps/esp01_1m/include/ directory.
I wasn’t aware that the files would be copied. If I change someInclude.h in the /generic/include directory, the changes are not propagated to the other projects.

Is there some way I can set up the appA and appB projects to access files in the generic project by reference rather than by value?

You should create real libraries, not just header files.
Then use lib_deps in combination of symlinks to point to those libraries from different projects.

See Creating a library
See Local folder

If you use a file structure like this:

.
├── libraries
│   ├── LibA
│   │   ├── src
│   │   │   ├── LibA.cpp
│   │   │   └── LibA.h
│   │   └── library.json
│   ├── LibB
│   └── LibC
└── projects
    ├── ProjectA
    │   ├── include
    │   ├── lib
    │   ├── src
    │   │   └── main.cpp
    │   ├── test
    │   └── platformio.ini
    ├── ProjectB
    ├── ProjectC
    └── ProjectD

You can reference your libraries from the projects by

lib_deps =
  symlink://../../libraries/LibA

Ok, thanks for this.