'cl'不被识别为内部或外部命令, [英] 'cl' is not recognized as an internal or external command,

查看:388
本文介绍了'cl'不被识别为内部或外部命令,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Qt Creator在Qt中编译一个hello world程序。



我得到'cl'不被识别为内部或外部命令。 / p>

我使用的是Windows 7和Both Vs 2008和2010。
当我使用Mingw它编译正常,但如果使用vs 2008它给出此错误。



设置Env路径后= ..; ..; C :\Program Files \Microsoft Visual Studio 9.0 \VC\bin也显示相同的错误。

解决方案

我认为 cl 不在你的路径。你需要添加它。建议您执行此操作的方法是启动开发人员命令提示符



引用 为命令行版本设置路径和环境变量


打开开发人员命令提示符窗口


  1. 在显示Windows 8开始屏幕时,键入 Visual Studio工具。请注意,搜索结果会随您键入而改变;



    在早期版本的Windows上,选择开始,然后选择 Visual Studio
    工具
    ,然后在搜索框中输入 Visual Studio Tools 。当 Visual Studio Tools 在搜索结果中显示
    时,请选择


  2. 文件夹中,打开您的Visual Studio版本的开发人员命令提示符。 (要以管理员身份运行,
    打开开发人员命令提示符的快捷菜单,然后选择以管理员身份运行
    。)



如文章所述,设置不同工具集有几种不同的快捷方式 - 您需要选择合适的工具集。



如果您已打开一个普通的命令提示符窗口,您可以使用适当的参数运行批处理文件 vcvarsall.bat 环境变量。引用同一篇文章:


运行vcvarsall.bat


  1. 在命令提示符下,切换到Visual C ++安装目录。 (该位置取决于系统和Visual Studio
    安装,但典型的位置是C:\Program Files
    (x86)\Microsoft Visual Studio版本\VC。)例如,输入:

      cd\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC


  2. 要为32位x86命令行构建配置此命令提示符窗口,请在命令提示符处输入:

      vcvarsall x86 



从文章中可能的参数如下:




  • x86 (x86 32位原生)

  • x86_amd64 (x86交叉上的x64)

  • x86_arm (x86交叉的ARM)

  • amd64 (x64 64位原生)

  • amd64_x86 x64 cross)

  • amd64_arm (ARM on x64 cross)


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

I am getting 'cl' is not recognized as an internal or external command.

I am using Windows 7 and Both Vs 2008 and 2010 installed in it. When I use Mingw it is compiling fine but if use vs 2008 it is giving this error.

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

解决方案

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.

Quoting the article Setting the Path and Environment Variables for Command-Line Builds:

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"
    

  2. To configure this Command Prompt window for 32-bit x86 command-line builds, at the command prompt, enter:

    vcvarsall x86
    

From the article, the possible arguments are the following:

  • x86 (x86 32-bit native)
  • x86_amd64 (x64 on x86 cross)
  • x86_arm (ARM on x86 cross)
  • amd64 (x64 64-bit native)
  • amd64_x86 (x86 on x64 cross)
  • amd64_arm (ARM on x64 cross)

这篇关于'cl'不被识别为内部或外部命令,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆