How can I run cl using x64?

限于喜欢 提交于 2019-12-25 07:59:25

问题


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

I typed vcvars32.bat 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 vcvars32.bat is 32 bits? Where can I find the 64 bit version?

Thanks


回答1:


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.



来源:https://stackoverflow.com/questions/38790813/how-can-i-run-cl-using-x64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!