Config UI

Command Pallet (CTRL + SHIFT + P) > Edit Configurations UI

This will give you a UI view, instead of editing the c_cpp_properties.json file directly

Compiler config files

.vscode/c_cpp_properties.json

https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference

Include Paths

.vscode/c_cpp_properties.json > “includePath”

/** on the end of a path makes it recursive, meaning that all sub directories will also be searched.

Using Long Path Names

The below should work, but doesn’t. It seems you simply have to ensure all of your project files and all of the \build\ output files (which are loooong) will fit within a 250 character limit. See https://www.esp32.com/viewtopic.php?f=13&t=31805

The registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled (Type: REG_DWORD) must exist and be set to 1.

If it isn’t you can set it using the PowerShell command:

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

Resolving path issues with duplicated files

The compiler is finding the same multiple files with the same name. E.g. when you right click > Show definition VS shows you the definition is available from multiple files.

Open “.vscode/c_cpp_properties.json”

In the “includePath” field, alter the paths order and make one of them a specific folder (without /** on the end). In this example, the files in “${workspaceFolder}/build/config/” will be used in priority to any other files of the same name that are in subdirectories off “${workspaceFolder}/**”

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${workspaceFolder}/build/config/",
                "${workspaceFolder}/**"
            ],

Compiler arguments

Places you can alter compiler arguments

.vscode/c_cpp_properties.json > “compilerArgs” field

Compiler to use

.vscode/c_cpp_properties.json > “compilerPath” field

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *