使用编译数据库

JSON 编译数据库格式规定了如何独立于编译系统重放单次编译。

编译数据库基本上是一个文件列表,以及用于编译这些文件的编译器标志。该数据库用于为代码模型提供必要的信息,以便在打开文件进行编辑时正确解析代码。

要将编译数据库作为项目打开,请访问File >Open File or Project ,然后选择一个编译数据库 JSON 文件。

要根据代码模型的信息生成编译数据库,请选择Build >Run Generator >Compilation Database

您可以在compile_database.json.files 中向项目添加文件,如非 C 语言文件。

您可以使用试验性的编译数据库项目管理器打开编译数据库中的文件,并访问 Clang 代码模型的所有编辑功能。

注意: 启用编译数据库项目管理器插件才能使用。

要在头文件和源文件之间切换,请选择Tools >C++ >Switch Header/Source

您可以在Projects 模式下为编译数据库项目指定自定义构建步骤和运行设置。

另请参阅 启用和禁用插件添加自定义构建步骤为运行配置项目代码模型配置项目

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.