(solved) VS Code: proper location for c_cpp_properties.json?

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

(solved) VS Code: proper location for c_cpp_properties.json?

Postby mzimmers » Fri Oct 01, 2021 4:43 pm

Hi all -

I thought I had my IDE set up properly, but now I'm not so sure.

I configured it according to the instructions, and can now build and flash my app. I wanted to try an example project, so I opened that folder, and to my surprise, the system couldn't find the header files within the IDF. Doing a little more looking, I realized that my c_cpp_properties.json file is within the project directory path.

I ran the "ESP-IDF Select Where to save configuration settings," and chose "Global." I expected this to move the c_cpp_properties.json file to my home .vscode directory, but it didn't.

What is the most straightforward way to remedy this? Should I just copy (and edit) the properties file? I'd like to set this up so that every project I open at least knows where to look for the IDF.

Thanks...
Last edited by mzimmers on Tue Nov 02, 2021 6:25 pm, edited 1 time in total.

ESP_bignacio
Posts: 229
Joined: Wed May 02, 2018 12:12 pm

Re: VS Code: proper location for c_cpp_properties.json?

Postby ESP_bignacio » Fri Oct 08, 2021 1:04 pm

The vscode configuration settings use a settings.json file. This can be global (User), Workspace (a .code-workspace file) or workspace folder (.vscode/settings.json) defined. This are used to configure Visual Studio Code and extension contributed settings.

The c_cpp_properties.json is a file specific to the Microsoft C/C++ extension and usually exists only in the workspace folder. This file is generated (copied from a template within the extension directory itself) by the ESP-IDF extension when you create a project with the New Project Wizard or Show Examples UI. What you defined for a specific project folder is not reflected globally.

You might need to set this file yourself depending on your project needs or just configure it to use compile_commands.json if you can build correctly.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: VS Code: proper location for c_cpp_properties.json?

Postby mzimmers » Tue Nov 02, 2021 6:25 pm

Thanks for the information, bignacio. Seems to be working correctly now.

Who is online

Users browsing this forum: No registered users and 7 guests