compile_commands.json 生成问题

win 下 生成 compile_commands.json

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

image

linux 下 生成 compile_commands.json

在linux下的处理就简单多了。

  1. 有 CMakeList.txt
    直接在文件中增加 set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ,然后执行 cmake 即可生成。

  2. 只有 makefile 文件。
    使用 bear ,下载后执行 bear -- make

posted @ 2025-02-03 22:39  最美的期待  阅读(636)  评论(0)    收藏  举报
levels of contents