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

Include files not found when in VSCode but fine when in ArduinoIDE #1614

Open
reflectingme opened this issue Mar 4, 2023 · 7 comments
Open

Comments

@reflectingme
Copy link

When I create a file within the ArduinoIDE2 everything runs fine, all the #includes are found and the file compiles and uploads to my LilyGo T-Display Touch board perfectly. However, when I open the very same file in VSCode, I get a multitude of cannot find source file errors.

Why would the code run perfectly in ArduinoIDE yet the very same file won't compile in VSCode. Any pointers please? Why would the include paths be any different?

Top part of screenshot is file in VSCode, bottom part is in Arduino.

Screenshot 2023-03-04 at 21 22 12

@github-actions github-actions bot added the triage New issues that have not been reviewed. label Mar 4, 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, the only way I'm able to compile is if I copy my libraries to the folder I mentioned above.
(I mentioned this find in another issue also)

@MickGyver
Copy link

From some more testing, I guess that the arduino-cli tool when used by VS Code doesn't use the configuration file (arduino-cli.yaml) that is stored in the folder %userprofile%.arduinoIDE by the Arduino IDE 2.0. I copied arduino-cli.yaml from %userprofile%.arduinoIDE\ to %userprofile%\AppData\Local\Arduino15\ and compilation now works.

@reflectingme
Copy link
Author

Thanks for this info, Mick. I've been a bit unwell the last few days so haven't looked into this more but starting to feel better now so will look tomorrow. I should also have mentioned in my original post that I am using VSCode on a Mac and not the Windows version, apologies.

@AJ-Work-Smoothie
Copy link

From some more testing, I guess that the arduino-cli tool when used by VS Code doesn't use the configuration file (arduino-cli.yaml) that is stored in the folder %userprofile%.arduinoIDE by the Arduino IDE 2.0. I copied arduino-cli.yaml from %userprofile%.arduinoIDE\ to %userprofile%\AppData\Local\Arduino15\ and compilation now works.

YOU ARE A BEAST! This is the only thing that I found has worked so far. Can you please share it other place? Apparently this is quite the unsolved problem.

@livingcreative
Copy link

Awesome. Moving yaml config helped.

@gcampbell-msft gcampbell-msft removed the triage New issues that have not been reviewed. label Dec 1, 2023
@waqasahmad531
Copy link

The solution that worked for me was to open the the C:\Users<username>\AppData\Local\Arduino15\arduino-cli.yaml file and update the user directory to the installation path of arduino which in my case was: C:\Program Files (x86)\Arduino

@vlrmprjct
Copy link

vlrmprjct commented Jul 11, 2024

You can also paste the arduino-cli.yaml file into the root directory of your project when using VSCode instead of copying this file into your %user% directory.

project.root
    /arduino-cli.yaml
    /.vscode
    /whatever
    /src
        /code
            /code.ino

It should work.

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

No branches or pull requests

7 participants