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

Visual C++ includes compilers that you can use to create apps that can run on a 32-bit, 64-bit, or ARM-based Windows operating system.

Note

For information about the specific tools that are included with each Visual C++ edition, see Visual C++ Tools and Templates in Visual Studio 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.

  • 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.

  • 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.

  • ARM on x86 (ARM cross compiler)
    Use this to create output files for ARM 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.

When Visual Studio is installed on a 64-bit Windows operating system, command prompts for the various 64-bit native and cross compilers are available. To access these command prompts on Windows 8, on the Start screen, open All apps. Under Microsoft Visual Studio 2012, choose one of the native-tool or cross-tool command prompts. On earlier versions of Windows, choose Start, expand All Programs, Microsoft Visual Studio 2012, 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 11.0\VC\vcvarsall.bat on 32-bit Windows operating systems, or C:\Program Files (x86)\Microsoft Visual Studio 11.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, an error message will be displayed. The following table shows the supported arguments.

Vcvarsall.bat argument

Compiler

Build-computer architecture

Build output architecture

x86

32-bit Native

x86, x64

x86

x86_amd64

x64 Cross

x86, x64

x64

amd64

x64 Native

x64

x64

x86_arm

ARM Cross

x86, x64

ARM

See Also

Other Resources

Configuring Programs for 64-Bit (Visual C++)