从命令行运行Qt Creator
您可以通过命令行启动Qt Creator 并指定一些选项。例如,您可以打开文件的任意行和列。
要使用命令行选项,请在包含Qt Creator 可执行文件的目录下输入以下命令,或在命令中指定Qt Creator 的路径:
qtcreator [option] [filename[:line_number[:column_number]]]
注意: 可以使用冒号(:)或加号(+)作为文件名与行号、行号与列号之间的分隔符。也可以在分隔符和行号之间使用空格。
CLI 命令示例
以下是在支持的平台上安装Qt Creator 时的命令示例。 Qt Online Installer安装到默认位置时的命令示例。请根据需要更改路径。
在 Windows 上
C:\Qt\Tools\QtCreator\bin\qtcreator -help
C:\Qt\Tools\QtCreator\bin\qtcreator C:\TextFinder\textfinder.cpp:100:2
C:\Qt\Tools\QtCreator\bin\qtcreator C:\TextFinder\textfinder.cpp +100+2
在 Linux 上
~/Qt/Tools/QtCreator/bin/qtcreator -help
~/Qt/Tools/QtCreator/bin/qtcreator /src/TextFinder/textfinder.cpp:100:2
~/Qt/Tools/QtCreator/bin/qtcreator /src/TextFinder/textfinder.cpp+100+2
在 macOS 上
~/Qt/Qt\ Creator.app/Contents/MacOS/Qt\ Creator -help
从目录打开项目
要打开位于特定目录下的项目,可以将目录名作为命令行参数传递。Qt Creator 查找与目录名匹配的会话并加载它。或者在目录中查找项目文件并打开它。
例如,在 Windows 上:
C:\qtcreator\bin>qtcreator.exe C:\Examples\alarms
另请参阅 命令行选项。
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.