Configuring Private Libraries with GIT inside a PlatformIO project

I have 2 private libraries into my ESP-32 project that compile and work correctly. But I don’t understand why mylib2 (very close to mylib1) display compile errors in VSCode.

I have the following architecture (based on Lilygo project)

  • Root
    • examples
      • myproject
    • lib
      • mylib1
      • mylib2
        • .git
        • myfile.h
        • myfile.cpp

If I open myfile.cpp I got an error on #include “myfile.h”
If I open myfile.h I got an errir on #include <Arduino.h>

I have the same logic with mylib1 without any errors. And the main project compile everything correctly.

I think the issue is related to the code C++ interpreter that highlight wrong errors but I don’t know how to tell to platformio or vscode the right info to fix the library dependencies.

Do you have multiple projects in your current workspace?

I don’t think so,

  • I open the main project (Lilygo code)
  • I git clone the 2 library

VSCode asked me if I add them to the workspace I say yes. So in the workspace and git I have all three :


and the code/folder is also visible in the TDisplay-S3 …/lib directory

Can you show more?
The screenshot is very limited. Hard to say what I’m seeing there.

If you clone the library directly into the lib folder, there is no need to add it to the workspace (again) since it is available via the lib-folder.

Personally I have only one (project) folder at a time open in vscode to avoid those types of issues.

Yes, as you can see the both “sub” project are in the right location and copile and etc … but the VSCode interpreter display a warning.

Probably because while trying to interpret the code it do not have the right path. But if I hit build, it works.

And the issue is ONLY to one of the two library that have a very similar code. It should be both or none.

So somewhere in some config I might do something ??? to do the correct links ?


  • Right click on the two bottom folders and choose “remove folder from workspace”
  • restart VS Code

Wow it works ! Thanks !
So for some reason, mulitple workspace messed-up with source code interpreter. But for only one of the 2 projects.

Weird … but cool it seems to work :slight_smile:

1 Like