使用编译数据库
JSON 编译数据库格式规定了如何在不依赖构建系统的情况下独立重现单次构建。
编译数据库基本上是一份文件列表,以及用于编译这些文件的编译器参数。当您打开文件进行编辑时,该数据库会向代码模型提供正确解析代码所需的必要信息。
要将编译数据库作为项目打开,请转至“File ” > “Open 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.