Bagikan melalui


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

Although not installed by default and not available in all editions (for more information, see Visual C++ Editions.), Visual C++ includes compilers that let you create applications that can run on a 64-bit Windows operating system.

See Visual Studio 64-bit Components for information on installing the 64-bit compilers.

For information on creating 64-bit applications inside the Visual Studio development environment, 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
    Allows you 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)
    Allows you 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)
    Allows you 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
    Allows you to create output files for Itanium. This version of cl.exe runs as a native process on an Itanium machine.

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

When the 64-bit compilers are installed on a 64-bit Windows operating system, you will see command prompts for the various 64-bit native and cross compilers. To access these command prompts, go to Start and then All Programs. From the Microsoft Visual Studio 2008 menu option, select Visual Studio Tools and then a command prompt.

Vcvarsall.bat

Any of the five compilers can be used from the command line by running the vcvarsall.bat batch file. By default, the full path for this file is C:\Program Files\Microsoft Visual Studio 9\VC\Vcvarsall.bat.

(Another way to enable the Visual C++ toolset is to use vcvars32.bat, but this 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, this batch file configures the necessary environment variables for using the x86, 32-bit compiler, but it can be used to configure any of the 64-bit compilers. The following table shows the supported arguments for vcvarsall.bat.

Vcvarsall.bat argument

Compiler

Host (either natively or using emulation)

Target architecture

"x86" (default)

32-bit Native

x86, x64, Itanium

x86

"x86_amd64"

x64 Cross

X86, x64, Itanium

x64

"x86_IPF"

Itanium Cross

X86, x64, Itanium

Itanium

"amd64"

x64 Native

x64

x64

"IPF" or "itanium"

Itanium Native

Itanium

Itanium

See Also

Other Resources

64-Bit Programming with Visual C++