Skip to content

Latest commit

 

History

History
58 lines (47 loc) · 2.01 KB

C_CPP_CONFIGURATION.md

File metadata and controls

58 lines (47 loc) · 2.01 KB

Configuration of c_cpp_properties.json file

Why configure this file?

The C/C++ Extension is used to provide C and C++ syntax highlight, code navigation and Go to declaration/definition within C and C++ files.

The file is located in {PROJECT_DIR}/.vscode/c_cpp_properties.json and can be generated by using Create ESP-IDF Project command.

Default configuration

With this configuration, the Intellisense engine of the C/C++ extension will include all header files found by performing a recursive search of the ${config:idf.espIdfPath}/components folder. For this configuration to work, you need to set you C/C++ Extension Intellisense engine to Tag Parser.

An example configuration that should work with most projects is shown below.

{
    "configurations": [
        {
            "name": "Linux",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": false
            }
        }
    ],
    "version": 4
}

Configuration with compile_commands.json

For this configuration, you must build your project beforehand in order to generate ${workspaceFolder}/build/compile_commands.json (where ${workspaceFolder} is your project directory). This file will then be used to resolve your C/C++ headers.


{
    "configurations": [
        {
            "name": "Linux",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}