我现在已经挣扎了一个小时,并希望得到一些帮助。我正在尝试将compile_commands.json
文件与vs代码和cpp扩展名一起使用。以下是我的c_cpp_properties.json
文件和compile_commands.json
文件。
...
{
"name": "Win32",
"intelliSenseMode": "clang-x64",
"includePath": [
"${workspaceRoot}",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/mingw32",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include/c++/backward",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include",
"C:/MinGW/mingw64/include",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include-fixed"
],
"defines": [
"_DEBUG",
"UNICODE",
"__GNUC__=6",
"__cdecl=__attribute__((__cdecl__))"
],
"compileCommands": "${workspaceFolder}/BlitzEngine/builds/Debug/compile_commands.json",
"browse": {
"path": [
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.2.0/include-fixed",
"C:/MinGW/mingw64/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
...
[
{
"directory": "C:/Users/Emburn/Documents/Projects/BlitzEngine/builds/Debug",
"command": "C:\\MinGW\\mingw64\\bin\\g++.exe @CMakeFiles/BlitzEngine.dir/includes_CXX.rsp -g -o CMakeFiles\\BlitzEngine.dir\\src\\BlitzEngine.cpp.obj -c C:\\Users\\Emburn\\Documents\\Projects\\BlitzEngine\\src\\BlitzEngine.cpp",
"file": "C:/Users/Emburn/Documents/Projects/BlitzEngine/src/BlitzEngine.cpp"
},
{
"directory": "C:/Users/Emburn/Documents/Projects/BlitzEngine/builds/Debug",
"command": "C:\\MinGW\\mingw64\\bin\\g++.exe @CMakeFiles/BlitzEngine.dir/includes_CXX.rsp -g -o CMakeFiles\\BlitzEngine.dir\\src\\main.cpp.obj -c C:\\Users\\Emburn\\Documents\\Projects\\BlitzEngine\\src\\main.cpp",
"file": "C:/Users/Emburn/Documents/Projects/BlitzEngine/src/main.cpp"
},
{
"directory": "C:/Users/Emburn/Documents/Projects/BlitzEngine/builds/Debug",
"command": "C:\\MinGW\\mingw64\\bin\\g++.exe @CMakeFiles/BlitzEngine.dir/includes_CXX.rsp -g -o CMakeFiles\\BlitzEngine.dir\\src\\RenderWindow.cpp.obj -c C:\\Users\\Emburn\\Documents\\Projects\\BlitzEngine\\src\\RenderWindow.cpp",
"file": "C:/Users/Emburn/Documents/Projects/BlitzEngine/src/RenderWindow.cpp"
}
]
我尝试使用没有${workspaceFolder}
的绝对路径,但是这也没有用,每次我保存文件时都会说
"${workspaceFolder}/BlitzEngine/builds/Debug/compile_commands.json"
could not be found. Using 'includePath'
setting in c_cpp_properties.json
我的目录树是这样的:
Projects
+-- .vscode
| +-- c_cpp_properties.json
+-- BlitzEngine
| +-- Debug
| | +-- compile_commands.json
+-- include
| +-- <header_files>
+-- src
| +-- <source_files>
提前感谢您的帮助!
答案 0 :(得分:1)
我看不到workspaceFolder
documentation中列出的c_cpp_properties.json
。这里的示例使用workspaceRoot
,您在配置中已经有了这些示例。