Page 1 of 1

VS Code: problem with include paths (C/C++ extension)

Posted: Wed Sep 15, 2021 6:11 pm
by mzimmers
Hi all -

I am trying to get my project to find esp-idf files, and running into some problems:
include.PNG
include.PNG (82.64 KiB) Viewed 9224 times
I don't recognize the syntax of these entries, but I suspect something is wrong with it. Can anyone help me correct these entries?

Thanks...

EDIT: I got rid of all but the first line, and the error went away. (I guess since I'm not running on Windows, and don't have ADF installed, those lines were causing the problem.)

Unfortunately, I still get the "file not found" errors in the editor. I'm thinking something must be wrong/missing from my configuration section.

Code: Select all

                   "/home/mzimmers/esp/esp-idf/components/**",
 //                   "${config:idf.espIdfPath}/components/**",
When I hard-code the path (like the first line above, it seems to work. When I try to use the symbol evaluator, it doesn't. Where is config:idf.espIdfPath defined?

Thanks...

Re: VS Code: problem with include paths (C/C++ extension)

Posted: Sat Sep 18, 2021 8:52 am
by ESP_bignacio
This ${config:df.espIdfPath} is basically using the esp-idf extension settings values, which as you can see are replaced by ${env:IDF_PATH}.

This doesn't work because you haven't configured the esp-idf extension using the setup wizard (Open command palette -> ESP-IDF: Configure ESP-IDF extension) by following this install tutorial, for example.

Re: VS Code: problem with include paths (C/C++ extension)

Posted: Mon Sep 20, 2021 3:47 pm
by mzimmers
Hi bignacio -

Thank you for the reply. I did run the setup wizard, choosing the "Use Existing Setup" option. Still doesn't find those variables.

Re: VS Code: problem with include paths (C/C++ extension)

Posted: Tue Sep 21, 2021 10:43 am
by mbratch
Does it work if you replace:

Code: Select all

${config:idf.espIdfPath}/components/**
with

Code: Select all

${env:IDF_PATH}/components/**
?

Re: VS Code: problem with include paths (C/C++ extension)

Posted: Wed Sep 22, 2021 1:09 am
by mzimmers
It didn't work, but then I realized that I don't automatically run the export.sh script -- I have an alias which I manually invoke from the shell. But I start up VS Code from the favorites bar. So I think that explains that.

I'm still curious to know why the original syntax didn't work, though.

Re: VS Code: problem with include paths (C/C++ extension)

Posted: Fri Sep 24, 2021 8:54 pm
by mbratch
Well, truth be told... I think I started from scratch maybe four times setting up VS Code with ESP-IDF before it finally "just worked". Each time being even more extra careful each step of the way. I think there are at least two different procedures kicking around for how to set it up. There's one published by Espressif Systems on Youtube, and another on their github page for the VS Code plugin. Once I had it working, I did have to tweak the paths a bit to get the intellisense working right (even though it would compile).

Re: VS Code: problem with include paths (C/C++ extension)

Posted: Tue Aug 30, 2022 11:43 am
by viktordenisenko
Hi mzimmers,
I have exactly the same problem with include path (C/C++) as you. Have you resolved this issue?
Thanks!