桌面设备运行设置
在Projects >Build & Run >Run >Run Settings 中为套件选择的运行设备上指定运行应用程序的设置。
工作目录
您可以指定要传递给可执行文件的命令行参数以及要使用的工作目录。工作目录默认为构建结果的目录。
选择Add Deploy Step >CMake Install 添加安装选项。Qt Creator 会自动添加Working directory 字段的值作为--install
签名中的安装目录。
在终端中运行
对于控制台应用程序,请选择Run in terminal 。要指定在 Linux 和 macOS 上使用的终端,请转到首选项>Environment >System 。要使用内部终端,请转至首选项>Terminal >Use internal terminal 。
链接器库
构建应用程序时,Qt Creator 会创建一个目录列表,链接器将在其中查找应用程序链接到的库。默认情况下,链接库对Qt Creator 试图运行的可执行文件可见。通常,只有在以下情况下才应禁用该选项:该选项会导致不必要的副作用;使用部署步骤(如make install
),并希望确保部署的应用程序在不运行Qt Creator 时也能找到库。
要禁用当前项目的库链接,请清除Add build library search path to PATH 。要禁用所有项目的库链接,请转到首选项>Build & Run ,然后清除Add linker library search paths to run environment 。
调试链接的框架
在 macOS 上,选择Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug) 可调试(例如,步入)链接框架,如 Qt 框架本身。调试应用程序代码时不需要此选项。
以根用户身份运行
在 Linux 和 macOS 上,选择Run as root user ,以根用户权限构建、部署和运行应用程序。
另请参阅 "配置运行项目"、"指定要运行的自定义可执行文件"和 "指定运行环境"。
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.