fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' Visual studio 2010 and cmake

≡放荡痞女 提交于 2020-05-15 04:04:42

问题


I have a project which i have generated with cmake and running in visual studio 2010.I changed the configuration to x64,in visual studio my active solution and the Target Machine in(Properties->Linker->Advanced) is set as x64.I still get the linker LNK1112 error.Is this something which i set in cmakelist.txt if so what is the command? -swetha


回答1:


It's not something you'd want to set in CMakeLists.txt. Basically, CMake has multiple generators for different compilers. (The x86 and x64 compilers are two distinct compilers on Windows.) When you generate the build files, you need to pass along the correct compiler for CMake to use, or if you use the GUI, select Win64. From the command line:

cmake -G "Visual Studio 14 Win64" path/to/your/CMakeLists.txt

or whatever version of Visual Studio you want. You can see the available generators with:

cmake --help

If this didn't solve your problem, try it again after deleting the generated build files.

If that still doesn't solve the issue, you are linking to a third party dependency built for x86.




回答2:


Try to delete all *.obj files in your solution and let compiler compile all files again. This problem may cause of compiler try to reference obj files that was compiled x64



来源:https://stackoverflow.com/questions/41762898/fatal-error-lnk1112-module-machine-type-x64-conflicts-with-target-machine-typ

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