Page 1 of 1

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

Posted: Mon Jan 11, 2021 8:57 am
by Pony Ma
When started up with Visual Studio Code , This problem happened.

Thanks for help...

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

Posted: Tue Jan 12, 2021 1:34 am
by TinkerBearNZ
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.

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

Posted: Tue Jan 12, 2021 7:41 am
by abansal22
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!

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

Posted: Thu Nov 18, 2021 1:20 pm
by Haidar
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.

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

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

Code: Select all

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

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

Posted: Wed May 04, 2022 11:37 pm
by ohsnapfit
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
}

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

Posted: Thu May 05, 2022 9:17 pm
by atemiz
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
}