当前位置: 动力学知识库 > 问答 > 编程问答 >

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

问题描述:

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

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: