简体   繁体   中英

Cannot Run Compiler 'cl' for qt5.10.1 on Windows 10 in terminal

I have never used qt before, but I got a task to build an already existing application for Windows and Mac using the newest version of qt. What I have done so far is:

  1. Installed Visual Studio Professional 2017.
  2. Installed the latest Qt 5 Open Source.

Note: when installing the QT 5 I installed all of the components under QT/ QT 5.10.1 which were: 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

  1. I cloned the branch from GitHub that I wanted to build to C:/Projects
  2. Then in Git Bash I cd to the project and tried to run qmake. The first time I had this problem: "bash: qmake: command not found" After searching into the problem I found out that I haven't added "Qt/5.10.1/msvc2017_64/bin" to PATH and I added it. Now when I echo $PATH I can see the directory added.
  3. Now after bash recognises qmake and I try to run it it says:

Project ERROR: Cannot run target compiler 'cl'. Output:

=================== Maybe you forgot to setup the environment?

I have no idea how to fix the problem due to the fact that I have never used QT to build anything before. Can you help me?

In the read me file for the application I am trying to build it says:

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.

I am a bit puzzled by the instructions, it does not say to run qmake -project anywhere, but there is a qt project file in the directory that I cd to. Does this mean that I don't have to run qmake -project?

Also I have no idea how to run make by using the -j4 and -j flags and how to run flags in general. Could someone help me?

I believe that for the Cannot Run Compiler 'cl' issue I have some kind of a problem with the set up. Did I install too many components or is it to do with the VS setup?

I highly recommend you to install Qt from the Qt installer, and to use Qt Creator.

However, if you want to use it from source, you first need to get a compiler (ex: MinGW). Then you need to execute the instructions, but you need to use a MinGW (or whatever compiler you use) command prompt, which will automatically set the environment variables needed.

Note that this is Windows specific. On mac and linux, the compiler's environment variables are already set in the default command prompt (if there is a compiler, obviously).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM