sspp sspp - 2 months ago 8x
C++ Question

How can I run cl using x64?

I had the same problem as here fatal error C1034: windows.h: no include path set

I typed

and that solved my problem but I want to link some 64-bit .lib files and when I do:

cl main.cpp xxxlib.lib

I get:

warning LNK4272: library machine type 'x64' conflict with target machine type 'x86'

Is it because I use the
is 32 bits? Where can I find the 64 bit version?



In order to make sure you have the proper environment variables set, the simplest way is to launch the respective command shell in the start menu.

For 64bit, this would be Visual Studio x64 Win64 Command Prompt (2010), then cl.exe is automatically correct. If you show the properties of this entry in the start menu, you'll also find more infos:

  • Start in: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\"
  • Target : %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64

From this, you see that the working directory is set, and vcvarsall.bat is called with the amd64 parameter. This is probably what you missed.