无法在终端 Windows 10 上为 qt5.10.1 运行 编译器 'cl'
Cannot Run Compiler 'cl' for qt5.10.1 on Windows 10 in terminal
我以前从未使用过 qt,但我接到了一项任务,即使用最新版本的 qt 为 Windows 和 Mac 构建一个已经存在的应用程序。到目前为止我所做的是:
- 已安装 Visual Studio Professional 2017。
- 安装了最新的 Qt 5 Open Source。
注意:在安装 QT 5 时,我安装了 QT/QT 5.10.1 下的所有组件,它们是:qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
- 我从 GitHub 克隆了我想构建的分支到 C:/Projects
- 然后在 Git Bash 我 cd 到项目并尝试 运行 qmake。我第一次遇到这个问题:
"bash: qmake: command not found"
搜索问题后,我发现我没有将 "Qt/5.10.1/msvc2017_64/bin" 添加到 PATH 并且我添加了它。现在,当我回显 $PATH 时,我可以看到添加的目录。
- 现在 bash 识别 qmake 后我尝试 运行 它说:
项目错误:无法 运行 目标编译器 'cl'。输出:
===================
也许你忘记设置环境了?
我不知道如何解决这个问题,因为我以前从未使用过 QT 构建过任何东西。你能帮助我吗?
在我尝试构建的应用程序的自述文件中说:
Step-by-step instructions
1. Clone this branch
2. cd into the project
3. Run qmake - this wil generate Makefiles for all of the project's modules
4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
我对指令有点疑惑,它并没有说到运行 qmake -project anywhere,但是在我cd到的目录中有一个qt项目文件。这是否意味着我不必 运行 qmake -project?
我也不知道如何 运行 使用 -j4 和 -j 标志以及如何 运行 一般标志。有人可以帮我吗?
我认为对于 Cannot 运行 Compiler 'cl' 问题,我的设置存在某种问题。是我安装了太多组件还是与 VS 设置有关?
我强烈建议您从 Qt 安装程序安装 Qt,并使用 Qt Creator。
但是,如果您想从源代码中使用它,您首先需要获得一个编译器(例如:MinGW)。然后你需要执行指令,但你需要使用 MinGW(或任何你使用的编译器)命令提示符,它会自动设置所需的环境变量。
请注意,这是 Windows 特定的。在 mac 和 linux 上,编译器的环境变量已经在默认命令提示符中设置(如果有编译器,显然)。
我以前从未使用过 qt,但我接到了一项任务,即使用最新版本的 qt 为 Windows 和 Mac 构建一个已经存在的应用程序。到目前为止我所做的是:
- 已安装 Visual Studio Professional 2017。
- 安装了最新的 Qt 5 Open Source。
注意:在安装 QT 5 时,我安装了 QT/QT 5.10.1 下的所有组件,它们是:qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
- 我从 GitHub 克隆了我想构建的分支到 C:/Projects
- 然后在 Git Bash 我 cd 到项目并尝试 运行 qmake。我第一次遇到这个问题: "bash: qmake: command not found" 搜索问题后,我发现我没有将 "Qt/5.10.1/msvc2017_64/bin" 添加到 PATH 并且我添加了它。现在,当我回显 $PATH 时,我可以看到添加的目录。
- 现在 bash 识别 qmake 后我尝试 运行 它说:
项目错误:无法 运行 目标编译器 'cl'。输出:
=================== 也许你忘记设置环境了?
我不知道如何解决这个问题,因为我以前从未使用过 QT 构建过任何东西。你能帮助我吗?
在我尝试构建的应用程序的自述文件中说:
Step-by-step instructions 1. Clone this branch 2. cd into the project 3. Run qmake - this wil generate Makefiles for all of the project's modules 4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
我对指令有点疑惑,它并没有说到运行 qmake -project anywhere,但是在我cd到的目录中有一个qt项目文件。这是否意味着我不必 运行 qmake -project?
我也不知道如何 运行 使用 -j4 和 -j 标志以及如何 运行 一般标志。有人可以帮我吗?
我认为对于 Cannot 运行 Compiler 'cl' 问题,我的设置存在某种问题。是我安装了太多组件还是与 VS 设置有关?
我强烈建议您从 Qt 安装程序安装 Qt,并使用 Qt Creator。
但是,如果您想从源代码中使用它,您首先需要获得一个编译器(例如:MinGW)。然后你需要执行指令,但你需要使用 MinGW(或任何你使用的编译器)命令提示符,它会自动设置所需的环境变量。
请注意,这是 Windows 特定的。在 mac 和 linux 上,编译器的环境变量已经在默认命令提示符中设置(如果有编译器,显然)。