C++ 找不到compile_commands.json
我已经为此挣扎了一个小时,希望能得到一些帮助。我正在尝试将C++ 找不到compile_commands.json,c++,json,cmake,visual-studio-code,C++,Json,Cmake,Visual Studio Code,我已经为此挣扎了一个小时,希望能得到一些帮助。我正在尝试将compile_commands.json文件与vs-code和cpp扩展名一起使用。下面是我的c_cpp_properties.json文件和compile_commands.json文件 c_cpp_properties.json 编译_commands.json 我尝试过在不使用${workspaceFolder}的情况下使用绝对路径,但这也不起作用,每次保存文件时,它都会说 "${workspaceFolder}/BlitzEng
compile_commands.json
文件与vs-code和cpp扩展名一起使用。下面是我的c_cpp_properties.json
文件和compile_commands.json
文件
c_cpp_properties.json
编译_commands.json
我尝试过在不使用${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>
项目
+--.vscode
|+--c_cpp_properties.json
+--闪电发动机
|+--调试
||+--编译_commands.json
+--包括
| +--
+--src
| +--
提前感谢您的帮助 我没有看到
c\u cpp\u properties.json中列出的workspaceFolder
。这里的示例使用了前面配置中的workspaceRoot
。您是手工编写的吗?我认为compile\u命令的标准做法是让一个工具(比如cmake
)为您生成它。@StephenNewell它是由cmake生成的。我只是想让vscode找到您在cúcppúu properties.json
文件中有“compileCommands.json”的文件,但实际的文件是蛇壳文件(即compileúu commands.json
)@StephenNewell-oh-woops。我只是把它恢复正常。我是在解决问题的时候做的。尽管您的错误消息仍然显示旧路径,但它仍然不起作用。另外,看起来您使用的是工作空间文件夹
,而不是工作空间根目录
(根据您的目录布局进行猜测)。@Julia-这就是我在曲棍球比赛时回答问题的方法:)
"${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>