6.4 KiB
c_cpp_properties.json Reference Guide
Example
{
"configurations": [
{
"name": "Win32",
"intelliSenseMode": "msvc-x64",
"includePath": [ "${workspaceFolder}" ],
"macFrameworkPath": [ "/System/Library/Frameworks" ],
"defines": [ "FOO", "BAR=100" ],
"forcedInclude": [ "${workspaceFolder}/include/config.h" ],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"compileCommands": "/path/to/compile_commands.json",
"browse": {
"path": [ "${workspaceFolder}" ],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}
Top-level properties
-
configurationsAn array of configuration objects that provide the IntelliSense engine with information about your project and your preferences. By default, the extension creates 3 configurations for you, one each for Linux, Mac, and Windows, but it is not required to keep them all. You may also add additional configurations if necessary.
-
versionWe recommend you don't edit this field. It tracks the current version of the c_cpp_properties.json file so that the extension knows what properties and settings should be present and how to upgrade this file to the latest version.
Configuration properties
-
nameA friendly name for the configuration. "Linux", "Mac", and "Win32" are special names that instruct the extension to load that configuration by default on the associated operating system unless additional configurations have been created. The status bar in VS Code will show you which configuration is active. You can also click on the label in the status bar to change the active configuration.
-
intelliSenseModeIf
"C_Cpp.intelliSenseEngine"is set to "Default" in your settings file, this property determines which mode the IntelliSense engine will run in."msvc-x64"maps to Visual Studio mode with 64-bit pointer sizes."clang-x64"maps to GCC/CLang mode with 64-bit pointer sizes. Windows uses"msvc-x64"by default and Linux/Mac use"clang-x64"by default. -
includePathIf
"C_Cpp.intelliSenseEngine"is set to "Default" in your settings file, this list of paths will be used by IntelliSense to search for headers included by your source files. This is basically the same as the list of paths you pass to your compiler with the-Iswitch; the IntelliSense engine will not do a recursive search in these paths for includes. If a GCC/CLang compiler is specified in thecompilerPathsetting, it is not necessary to list the system include paths in this list. -
macFrameworkPathIf
"C_Cpp.intelliSenseEngine"is set to "Default" in your settings file, this list of paths will be used by IntelliSense to search for framework headers included by your source files. This is basically the same as the list of paths you pass to your compiler with the-Fswitch; the IntelliSense engine will not do a recursive search in these paths for includes. -
definesIf
"C_Cpp.intelliSenseEngine"is set to "Default" in your settings file, this list of preprocessor symbols will be used by IntelliSense during the compilation of your source files. This is basically the same as the list of symbols you pass to your compiler with the-Dswitch. -
forcedInclude(optional)A list of files that should be included before any other characters in the source file are processed. Files are included in the order listed.
-
compilerPath(optional)The absolute path to the compiler you use to build your project. The extension will query the compiler to determine the system include paths and default defines to use for IntelliSense. Args can be added to modify the includes/defines used, e.g.
-nostdinc++,-m32, etc., but paths with spaces must be surrounded by double quotes (") if args are used. -
cStandardThe C standard revision to use for IntelliSense in your project.
-
cppStandardThe C++ standard revision to use for IntelliSense in your project.
-
compileCommands(optional)If
"C_Cpp.intelliSenseEngine"is set to "Default" in your settings file, the includes and defines discovered in this file will be used instead of the values set forincludePathanddefines. If the compile commands database does not contain an entry for the translation unit that corresponds to the file you opened in the editor, then a warning message will appear and the extension will use theincludePathanddefinessettings instead.For more information about the file format, see the Clang documentation. Some build systems, such as CMake, simplify generating this file.
-
browseThe set of properties used when
"C_Cpp.intelliSenseEngine"is set to"Tag Parser"(also referred to as "fuzzy" IntelliSense, or the "browse" engine). These properties are also used by the Go To Definition/Declaration features, or when the "Default" IntelliSense engine is unable to resolve the #includes in your source files.
Browse properties
-
pathThis list of paths will be used by the Tag Parser to search for headers included by your source files. The Tag Parser will automatically search all subfolders in these paths unless the path ends with a
/*or\*. For example,/usr/includedirects the Tag Parser to search theincludefolder and its subfolders for headers while/usr/include/*directs the Tag Parser not to look in any subfolders of/usr/include. -
limitSymbolsToIncludedHeadersWhen true, the Tag Parser will only parse code files that have been directly or indirectly included by a source file in
${workspaceFolder}. When false, the Tag Parser will parse all code files found in the paths specified in the path list. -
databaseFilenameWhen set, this instructs the extension to save the Tag Parser's symbol database somewhere other than the workspace's default storage location. If a relative path is specified, it will be made relative to the workspace's default storage location, not the workspace folder itself. The
${workspaceFolder}variable can be used to specify a path relative to the workspace folder (e.g.${workspaceFolder}/.vscode/browse.vc.db)