Using Visual Studio's 'cl' from a normal command line

后端 未结 7 1357
生来不讨喜
生来不讨喜 2020-11-28 21:28

Visual Studio 2003 and 2005 (and perhaps 2008 for all I know) require the command line user to run in the \'Visual Studio Command Prompt\'. When starting this command promp

相关标签:
7条回答
  • 2020-11-28 21:55

    Create your own batch file (say clenv.bat), and call that instead of cl:

    @echo off
    :: Load compilation environment
    call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
    :: Invoke compiler with any options passed to this batch file
    "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe" %*
    

    clenv.bat can now be invoked just like cl.exe, except that it will first load the needed environment variables first.

    0 讨论(0)
提交回复
热议问题