小编Avi*_*Avi的帖子

在 Windows 上使用 cmake 和 VS Code 时没有compile_commands.json 文件

我正在尝试将 Clang-Tidy 静态分析工具集成到我的构建系统中。我的设置遇到一些问题。

步骤cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..不生成compile_commands.json文件。因此,clang-tidy 给出了以下错误。

>cmake --build .结果

Could not auto-detect compilation database from directory "C:/dev/my-project/build/compile_commands.json"
  No compilation database found in C:\dev\my-project\build\compile_commands.json or any parent directory
  fixed-compilation-database: Error while opening fixed database: no such file or directory
  json-compilation-database: Error while opening JSON database: no such file or directory
  Running without flags.
  Error while processing C:\dev\my-project\src\.
CUSTOMBUILD : error : unable to handle compilation, expected exactly one compiler job in '' [clang-diagnostic-error] [C:\dev\my-project\build\analyze_clang_tidy.vcxproj]
  Suppressed 1 warnings …
Run Code Online (Sandbox Code Playgroud)

c++ cmake visual-studio-code clang-tidy

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1

clang-tidy ×1

cmake ×1

visual-studio-code ×1