VSCode is not including esp-idf/components/ path

linguisticat
Posts: 1
Joined: Wed Dec 21, 2022 6:54 am

VSCode is not including esp-idf/components/ path

Postby linguisticat » Wed Dec 21, 2022 8:11 am

Hello all,

Please forgive my ignorance, I'm a complete newb. I've been trying to solve this issue for the last couple of days, and I can't seem to figure out what I'm doing wrong. I'm following a tutorial (https://embeddedexplorer.com/controllin ... ow-energy/) using VS Code and when I build the project I get a fatal error for "nvs_flash.h" and "driver/gpio.h" stating "No such file or directory." I have ~/esp/esp-idf/components folders installed with all the required files & folders (including the ./components/nvs_flash/ and ./components/driver/gpio/ folders) on my system. But it appears as if the build is only searching the workspace/components folder and not the /esp/esp-idf/ directory. I also noticed that when I open the C/C++ Configurations UI, the Include path has a few lines highlighted in red, "Cannot find: /User/me/workspace/project/${env" and "Cannot find: /User/me/workspace/project/IDF_PATH}/components/". This error leads me to believe that there is a line somewhere that has "${env:IDF_PATH}/components/" that is not being parsed properly and splitting the path at the colon (:). But I don't know where to look and I can't find it (and it's not in the "c_cpp_properties.json" file. I've checked and also tried adding/removing similar include paths, with no success). That is just a guess, though. Any help would be greatly appreciated!

Also, is there a resource/guide/document anywhere that explains exactly what/how to use the path commands (e.g. ${config:idf.espxxxxx}, ${workspaceFolder}, etc)? Thank you very much!

Respectfully,
Nathan J

Nespressif
Posts: 76
Joined: Tue Sep 12, 2017 11:25 am

Re: VSCode is not including esp-idf/components/ path

Postby Nespressif » Wed Dec 21, 2022 10:44 am

Hello Nathan , I don't use VSCode IDE, I use Atom, but I simply compile from the command interface with the idf.py menuconfig...build...fash etc. command. The IDE I only use for editing.

I think the best thing to do is to configure your OS following the getting started guide, https://docs.espressif.com/projects/esp ... index.html see what works well for you and then see if you can configure VSCode or use it only for editing and compile from the command interface.

Regards,

ashelman-ec
Posts: 9
Joined: Fri May 13, 2022 6:08 am

Re: VSCode is not including esp-idf/components/ path

Postby ashelman-ec » Tue Dec 27, 2022 9:20 am

Note: I set up VS Code and ESP-IDF per the Espressif guide and building and running from within VS Code is working for me.

rsimpsonbusa
Posts: 124
Joined: Tue May 17, 2016 8:12 pm

Re: VSCode is not including esp-idf/components/ path

Postby rsimpsonbusa » Wed Dec 28, 2022 9:06 pm

Hi alshelman-ec.

Learning is tough. VSC is great but espressif is also complicated itself.

I just finished setting up a esp32 rainmaker project and it took days to move from the Examples folder to an independent folder. So, yeah, its kinda complicated.

My advice, from what i can read, is to reinstall from scratch again. Your source program wont be lost but still back it up.

You should always describe your environment, W10/OSX/LINUX etc. The ESP you are using, etc.

In any case, this is how you can REINSTALL an espressif version again given there is no such option in the esp-idf menus (AFIK) for a MAC/OSX environment.

In your desktop open a new finder window Apple-N (or Command-N however u want to call it). Then Shift-Command-G which prompts to define a directory. Type / and return.

The window now is in your root folder. DClick Users and then your username (say alsheman). Now you can see there is a folder named "esp". You need to move it to the trash or rename it. Also, do a Shift-Command-. (period) to see hidden directories. You will see one named ".espressif", erase or rename it.

Now open your VSC app. If the espressif extension was installed (by your description it seems so) the Installation Menu will have poped out and you can now choose the Express installation(if not uninstall the Expressif extension form VSC and install it again). Choose a version (I do not recommend latest v5.0, try one before that).

Go thru the process and wait for it to finish.

When done, try a simple hello program like

Code: Select all

#include <stdio.h>
void app_main(void)
{
    printf("Hello world!\n");
}
Start the Menuconfig just in case and save/close. (Dented Wheel icon at the bottom)
Build/flash/Monitor (Fire icon at the bottom right) . Should have no problems.

By doing this you now know that the whole environment is correctly set up. If you later want to work with SPI/I2C/ GPIO or whatever, just add the required file header (drive/Gpio.h etc).

From there, to big projects.

Good luck

joseMiguel
Posts: 22
Joined: Sun Oct 25, 2020 11:43 pm

Re: VSCode is not including esp-idf/components/ path

Postby joseMiguel » Sat Apr 08, 2023 7:45 pm

Hi,

try the c_cpp_properties.json in (.vscode directory)
I have added
"${workspaceFolder}/**", in the "browse" part

Code: Select all

{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "",
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${config:idf.espAdfPath}/components/**",
                "${config:idf.espAdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${config:idf.espAdfPath}/components/**",
                    "${config:idf.espAdfPathWin}/components/**",
                    "${workspaceFolder}/**",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": false
            }
        }
    ],
    "version": 4
}
I hope it resolve you problem

Kind regards

José Michel
José Michel

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 225 guests