Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 660
swetha Avatar asked Mar 10 '23 02:03

swetha


1 Answers

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.

like image 125
Cinder Biscuits Avatar answered Mar 19 '23 23:03

Cinder Biscuits