How to fix "include path " problems in VS code IDE?

Pony Ma
Posts: 6
Joined: Fri Jan 08, 2021 6:35 am

How to fix "include path " problems in VS code IDE?

Postby Pony Ma » Mon Jan 11, 2021 8:57 am

When started up with Visual Studio Code , This problem happened.

Thanks for help...
Attachments
include path.png
include path.png (99.73 KiB) Viewed 30784 times

User avatar
TinkerBearNZ
Posts: 9
Joined: Mon Jun 17, 2019 11:20 pm

Re: How to fix "include path " problems in VS code IDE?

Postby TinkerBearNZ » Tue Jan 12, 2021 1:34 am

Do you have the C/C++ Extension installed?

I'm struggling to remember what I did to fix this, but I believe it's a matter of letting or making the C/C++ extension use build/compile_commands.json to find the proper include path.

compile_commands.json is available after you've done your first build.

abansal22
Posts: 105
Joined: Wed Apr 22, 2020 8:24 am

Re: How to fix "include path " problems in VS code IDE?

Postby abansal22 » Tue Jan 12, 2021 7:41 am

Hello,
These combination of the extension version works for me.
c/c++ ver 1.1.3
Espressif idf 0.5.1

Also to get rid of the error lines, you need to build the project first. Only after that vscode will be able to find the headers. Thanks!

Haidar
Posts: 2
Joined: Thu Nov 11, 2021 1:17 pm

Re: How to fix "include path " problems in VS code IDE?

Postby Haidar » Thu Nov 18, 2021 1:20 pm

I had he same problem, I downloaded MinGW compiler then I added his directory to the "environment variable" -or something like that- then it was solved, but the build failes, and there is an error in he C/C++ cofiguration (UI) displaying:

Cannot find: ${env:IDF_PATH}/components/
Cannot find: ${env:ADF_PATH}/components/
Cannot find: ${env:ADF_PATH}/components/

and I'm searching for a solution right now.

atemiz
Posts: 2
Joined: Sun Apr 03, 2022 12:19 pm

Re: How to fix "include path " problems in VS code IDE?

Postby atemiz » Sun Apr 03, 2022 12:23 pm

Add compile_commands.json to your c_cpp_properties.json

Code: Select all

"compileCommands": "${workspaceFolder}/build/compile_commands.json"

ohsnapfit
Posts: 1
Joined: Wed May 04, 2022 11:31 pm

Re: How to fix "include path " problems in VS code IDE?

Postby ohsnapfit » Wed May 04, 2022 11:37 pm

atemiz wrote:
Sun Apr 03, 2022 12:23 pm
Add compile_commands.json to your c_cpp_properties.json

Code: Select all

"compileCommands": "${workspaceFolder}/build/compile_commands.json"
I have the same issue and am following along. How do I " Add compile_commands.json to your c_cpp_properties.json"

Currently my c_cpp_properties.json file is

{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${config:idf.espIdfPath}/components/**"
],
"browse": {
"path": [
"${config:idf.espIdfPath}/components"
],
"limitSymbolsToIncludedHeaders": false
},
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-gcc-x64",
"configurationProvider": "ms-vscode.cpptools",
"compilerPath": "C:\\.espressif\\tools\\xtensa-esp32-elf\\esp-2021r2-patch3-8.4.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gcc.exe"
}
],
"version": 4
}

atemiz
Posts: 2
Joined: Sun Apr 03, 2022 12:19 pm

Re: How to fix "include path " problems in VS code IDE?

Postby atemiz » Thu May 05, 2022 9:17 pm

ohsnapfit wrote:
Wed May 04, 2022 11:37 pm
atemiz wrote:
Sun Apr 03, 2022 12:23 pm
Add compile_commands.json to your c_cpp_properties.json

Code: Select all

"compileCommands": "${workspaceFolder}/build/compile_commands.json"
I have the same issue and am following along. How do I " Add compile_commands.json to your c_cpp_properties.json"
As an example, the configuration file content that I am currently using is as follows;

Code: Select all

{
    "configurations": [
        {
            "name": "ESP32-C3",
            "includePath": [
                "${default}"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}

Who is online

Users browsing this forum: jsmith56x and 295 guests