Megosztás a következőn keresztül:


How to: Enable a 64-Bit Visual C++ Toolset at the Command Line

Visual C++ includes compilers that you can use to create applications that can run on a 32-bit x86, 64-bit x64, or Itanium–based Windows operating system.

Note

The 64-bit compilers are not available or installed by default in all Visual C++ editions. For information about the specific tools that are included in each edition, see Visual C++ Editions.

For information about how to use the Visual Studio development environment to create 64-bit applications, see How to: Configure Visual C++ Projects to Target 64-Bit Platforms.

The following list describes the various versions of cl.exe (the Visual C++ compiler).

  • x86 on x86
    Use this to create output files for x86 machines. This version of cl.exe runs as a 32-bit process, native on an x86 machine and under WOW64 on a 64-bit Windows operating system.

  • Itanium on x86 (Itanium cross-compiler)
    Use this to create output files for Itanium. This version of cl.exe runs as a 32-bit process, native on an x86 machine and under WOW64 on a 64-bit Windows operating system.

  • x64 on x86 (x64 cross-compiler)
    Use this to create output files for x64. This version of cl.exe runs as a 32-bit process, native on an x86 machine and under WOW64 on a 64-bit Windows operating system.

  • Itanium on Itanium
    Use this to create output files for Itanium. This version of cl.exe runs as a native process on an Itanium machine.

  • x64 on x64
    Use this to create output files for x64. This version of cl.exe runs as a native process on an x64 machine.

When the 64-bit native and cross compilers are installed, command prompts for the various compilers are available. To access these command prompts, choose Start, expand All Programs, Microsoft Visual Studio 2010, and Visual Studio Tools, and then choose a command prompt.

Vcvarsall.bat

Any of the compilers can be used on the command line by running the Vcvarsall.bat batch file to configure the path and environment variables that enable the compiler toolset. By default, the full path of this file is either C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat on 32-bit Windows operating systems, or C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat on 64-bit systems.

Note

Although you can use Vcvars32.bat to enable the Visual C++ toolset, it only enables the 32-bit compiler. For more information, see Setting the Path and Environment Variables for Command-Line Builds.

If no arguments are provided, the Vcvarsall.bat batch file configures the environment variables for using the x86, 32-bit compiler. However, you can use it to configure any of the compilers. If you specify a compiler configuration that is not installed or is not available on your build computer architecture, you will get an error message. The following table shows the supported arguments.

Vcvarsall.bat argument

Compiler

Build-computer architecture

Build output architecture

x86

32-bit Native

x86, x64, Itanium

x86

x86_amd64

x64 Cross

x86, x64, Itanium

x64

x86_ia64

Itanium Cross

x86, x64, Itanium

Itanium

amd64

x64 Native

x64

x64

ia64

Itanium Native

Itanium

Itanium

See Also

Other Resources

64-Bit Programming with Visual C++