compile_commands.json 生成问题
win 下 生成 compile_commands.json
- 在 visual studio 202X 的 【拓展-拓展管理器】下载 Clang Power Tools 2022 插件。
- 在项目右键,就会出现 Export Compilation Database 的选项。
- 选择后就会生成 compile_commands.json 。


linux 下 生成 compile_commands.json
在linux下的处理就简单多了。
-
有 CMakeList.txt
直接在文件中增加 set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ,然后执行 cmake 即可生成。 -
只有 makefile 文件。
使用 bear ,下载后执行 bear -- make

浙公网安备 33010602011771号