Issue with VSCode finding stdlib

CatalinM
Posts: 2
Joined: Sat Dec 28, 2024 5:22 pm

Issue with VSCode finding stdlib

Postby CatalinM » Sat Dec 28, 2024 6:05 pm

Heya!

My project is building/running just fine, but VSCode (or better said the C/C++ extension) is driving me nuts not finding `stdlib.h`. I've scoured the internet and tried a lot of solutions, but it just doesn't want to work.

Here's my `c_cpp_properties.json`:

Code: Select all

{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "${config:idf.toolsPath}/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc",
            "compileCommands": "${config:idf.buildPath}/compile_commands.json",
            "includePath": [
                "${config:idf.toolsPath}/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/*",
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.toolsPath}/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/*",
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${workspaceFolder}/**"
                ],
                "limitSymbolsToIncludedHeaders": false
            },
            "cStandard": "c17"
        }
    ],
    "version": 4
}
I've manually added the first line of both `includePath` and `browse.path` since I've looked for the esp toolchain version of stdlib.h and that's where I found it. I should mention that I'm using `zsh` and I sourced `export.sh` in my `.zshrc` to get stuff working in the command line - not sure if it impacts this, but...

Would appreciate any suggestions you might have.

ESP_radurentea
Posts: 21
Joined: Thu Mar 09, 2023 8:30 am

Re: Issue with VSCode finding stdlib

Postby ESP_radurentea » Mon Dec 30, 2024 8:48 am

Hi,

Try to use the following for both includePath and browse:

Code: Select all

"${config:idf.toolsPath}/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include"
If you are not having issues only with stdlib.h, make sure you have the compile_commands.json in your build folder. You can generate it using the command: ESP-IDF: Run idf.py reconfigure task

CatalinM
Posts: 2
Joined: Sat Dec 28, 2024 5:22 pm

Re: Issue with VSCode finding stdlib

Postby CatalinM » Mon Dec 30, 2024 11:27 am

Yup, I have that in both `includePath` and `browse` (see my snippet above, it's below the fold). The only difference is `/*` at the end, but I've tried with or without and there's no difference.

Also tried regenerating `compile_commands.json`, without success. As far as I've noticed this only happens with `stdlib.h` and `stdio.h`, but I actually don't need the latter so I haven't bothered.

It's probably an issue with the C/C++ extension, but since it's not giving me much info (or I don't know where to find it), I'm a bit stuck with debugging it.

Who is online

Users browsing this forum: No registered users and 16 guests