Programmers learn & share
0 votes
104 views

Problem :

I am new to Qt. I am trying to compile the hello world program in Qt Using Qt Creator.

But I am getting following error ” 'cl' is not recognized as an internal or external command.”

I am on Windows 8 and also both Vs 2008 and 2010 installed on my machine. When I use Mingw it is compiling correctly but if if I am using it vs 2008 it is giving the above mentioned error.

Even after Setting my Env Path =..;..;C:\Program Files\Microsoft Visual Studio 9.0\VC\bin also it is showing the same error.

by (7.5k points)   | 104 views

2 Answers

0 votes

Solution :

I guess cl is not present in your path. So now you just need to add it there. The recommended way to do it is by launching a developer command prompt.

To open the Developer Command Prompt window please follow below steps

1.  For Windows 8 in Start screen type Visual Studio Tools. Once the search results change as you type; when Visual Studio Tools appears, just select it.

For earlier versions of Windows you need to choose Start, and then in the search box, type Visual Studio Tools. When Visual Studio Tools appears in the search results, select it.

2.  In your Visual Studio Tools folder please open the Developer Command Prompt for your version of Visual Studio. If want to run it as administrator please open the shortcut menu for the Developer Command Prompt and select Run as Administrator

by (36.1k points)  
0 votes

Solution:

I think cl isn't in your path. You need to add it there. The recommended way to do this is to launch a developer command prompt.

To open a Developer Command Prompt window

  1. With the Windows 8 Start screen showing, type Visual Studio Tools. Notice that the search results change as you type; when Visual Studio Tools appears, choose it.

    On earlier versions of Windows, choose Start, and then in the search box, type Visual Studio Tools. When Visual Studio Tools appears in the search results, choose it.

  2. In the Visual Studio Tools folder, open the Developer Command Prompt for your version of Visual Studio. (To run as administrator, open the shortcut menu for the Developer Command Prompt and choose Run as Administrator.)

As the article notes, there are several different shortcuts for setting up different toolsets - you need to pick the suitable one.

If you already have a plain Command Prompt window open, you can run the batch file vcvarsall.bat with the appropriate argument to set up the environment variables. Quoting the same article:

To run vcvarsall.bat

  1. At the command prompt, change to the Visual C++ installation directory. (The location depends on the system and the Visual Studio installation, but a typical location is C:\Program Files (x86)\Microsoft Visual Studio version\VC.) For example, enter:

cd "\Program Files (x86)\Microsoft Visual Studio 12.0\VC"
  1. To configure this Command Prompt window for 32-bit x86 command-line builds, at the command prompt, enter:

vcvarsall x86

I had the same problem. Try to make a bat-file to start the Qt Creator. Add something like this to the bat-file:

call "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"  
"C:\QTsdk\qtcreator\bin\qtcreator"

Now I can compile and get:

jom 1.0.8 - empower your cores
11:10:08: The process "C:\QTsdk\qtcreator\bin\jom.exe" exited normally.

 

ago by (11.2k points)  
2,227 questions
2,734 answers
59 comments
241 users