为多个平台构建
您可以为多个目标平台构建应用程序,或使用不同的编译器、调试器或 Qt 版本。套件可定义要使用的工具、设备类型和其他设置。
默认情况下,运行应用程序时,首先会自动构建和部署应用程序。不过,也可以分别执行每个操作。
要检查应用程序代码是否可针对设备进行编译和链接,请构建项目。您可以在 "问题"(Issues)中查看构建错误和警告,并在 "编译输出"(Compile Output)中查看更多详细信息。
构建应用程序
要构建应用程序,请
- 选择Build and Run Kit Selector 图标或转到Build >Open Build and Run Kit Selector ,然后选择构建和运行工具包或Android 设备。

- 转到Build ,然后选择Build Project 或Ctrl+B。
或者,选择
(Run) 以在构建应用程序后部署和运行应用程序。
取消构建
在构建应用程序时,
(Build) 按钮会变为
(Cancel Build) 按钮。要取消构建,请
- 选择
。 - 选择Alt+Backspace。
- 转到Build ,然后选择Cancel Build 。
如果您选择了构建命令,现在还想运行应用程序,请选择Run 按钮,以便在构建完成后安排运行项目。
以多种配置构建项目
访问Build ,然后选择菜单命令来构建、重建和清理项目。
要在所有配置中构建当前项目,即在所有启用的工具包中构建所有配置,请选择Build Project for All Configurations 。
要构建所有打开的项目,请选择Build All Projects 。如果构建一个应用程序失败,Qt Creator 会显示一条错误信息,并继续构建其他应用程序。
要以所有配置构建所有打开的项目,请选择Build All Projects for All Configurations 。
构建文件或子项目
要快速检查编译输出是否包含您在一个文件或子项目中所做的更改,请选择Build 菜单命令来构建它。可用的构建菜单命令取决于你为项目选择的构建系统:CMake、qmake 或 Qbs。
选择Build for Run Configuration 可构建与所选运行配置相对应的可执行文件。您也可以使用定位器中的cm 过滤器。
删除构建工件
要删除所有构建工件,请访问Build 并选择Clean 。
要清理构建目录然后构建项目,请选择Rebuild 。
要构建和清理不带依赖关系的项目,请在Projects 视图的上下文菜单中选择Build Without Dependencies 、Rebuild Without Dependencies 和Clean Without Dependencies 选项。
另请参阅 "为构建配置项目"、"如何:构建和运行"、"添加 Docker 设备"和 "指定构建设置"。
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.