Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

How to tell vscode to check for libraries folder ? #1602

Open
eagl1 opened this issue Feb 22, 2023 · 8 comments
Open

How to tell vscode to check for libraries folder ? #1602

eagl1 opened this issue Feb 22, 2023 · 8 comments
Assignees

Comments

@eagl1
Copy link

eagl1 commented Feb 22, 2023

Hi,

I'm trying to compile my ESP32 code, but vscode don't know where my "libraries" folder is.

image

How to set the folder's path ?

Almost same problem as #1033

@github-actions github-actions bot added the triage New issues that have not been reviewed. label Feb 22, 2023
@benmcmorran benmcmorran self-assigned this Feb 22, 2023
@benmcmorran
Copy link
Member

Can you try installing the library that provides TFT_eSPI.h (and any other headers you need) using the library manager in VS Code? Run the "Arduino: Library Manager" command in the VS Code command palette. If you started using the Arduino CLI in the latest version of this extension, libraries may be in a different directory now (see #1595).

@benmcmorran benmcmorran added bug intellisense needs-more-info More details about this issue are needed for it to be actionable. and removed triage New issues that have not been reviewed. labels Feb 22, 2023
@eagl1
Copy link
Author

eagl1 commented Feb 22, 2023

OK, after a many error/trail, I solved most of the errors.

But left this one:

image

@eagl1
Copy link
Author

eagl1 commented Feb 23, 2023

I solved part of the problem with these settings:

"includePath": [ "${workspaceFolder}/**", "D:/Program_Files/Arduino/hardware/arduino-esp32-master/libraries", "D:/Program_Files/Arduino/hardware/arduino-esp32-master/cores/esp32", "D:/Program_Files/Arduino/libraries", "D:/Program_Files/Arduino/hardware/tools/avr/lib/gcc/avr/7.3.0/include" ],

But I moved the project folder and got the errors again !

Working with vscode isn't easy.

@eagl1
Copy link
Author

eagl1 commented Feb 26, 2023

I think the procedure has to be done is the following:

  1. Compile the code without the included libraries.
  2. vscode will generate necessary ".json" files in the ".vscode" folder, for the compiled code. Like this:

image

  1. After that, the programmer can add the libraries path in the "c_cpp_properties". Like this:

image

@eagl1 eagl1 closed this as completed Mar 2, 2023
@eagl1 eagl1 reopened this Mar 2, 2023
@github-actions github-actions bot added triage New issues that have not been reviewed. and removed needs-more-info More details about this issue are needed for it to be actionable. labels Mar 2, 2023
@MickGyver
Copy link

MickGyver commented Mar 10, 2023

It seems that on Windows, libraries must be in the C:\Users\[user]\Documents\Arduino\libraries folder, then they will be found by the compiler. I tried @eagl1 's trick of compiling without the headers first to get the c_cpp_properties.json file but the only way I'm able to compile is if I copy my libraries to the folder I mentioned above.

@eagl1
Copy link
Author

eagl1 commented Mar 10, 2023

Yes, that is on Windows.

You can use the path C:\Users[user]\Documents\Arduino\libraries, and I'm sure this is for the new Arduino IDE 2.0, as I'm working with the legacy Arduino IDE. I'm happy I learned how to setup this wonderful IDE.

But I got back to the legacy Arduino IDE, it's more convenient for me more than vscode and the new Arduino IDE.

@oskardev
Copy link

Maybe it will be helpful - maybe not - I had a project already created in the Arduino IDE then I decided to use the Arduino extension for VS Code.
I was able to verify the project and upload - no problems detected. But the headers were highlighted - like on the screenshots shown earlier. Of course it was not possible to jump to the header too. But the compiler somehow didn't have the problems.
In the c_cpp_properties.json I had all needed paths (I didn't add it manually).

So I created the new folder, new .ino file, just pasted the content from the existing project - it was needed only to set the port, board and the output folder - no build problems, no problems with uploading.

I checked the old and new cofig files in .vscode i neach project. Looks like we have some differences.

arduino.json:
02

c_cpp_properties.json (additional content in the old project):
01

c_cpp_properties.json again with this diff section and full includePath content:
03

So I copied the new config files to the old project - now looks like everything is ok.

@eagl1
Copy link
Author

eagl1 commented Mar 13, 2023

  1. The differences in arduino.json are just in the sequence of the arguments.
  2. The workspaceFolder should contain your application libraries. Like this:

image

  1. The includePath should contain the hardware libraries.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants