visual c++ - fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' -


i'm using cuda (vc++, visual studio 2008sp1) debug fem program. program can run on win32 platform, insufficiency of cuda. think library files linked compiled on x86 platform, when compile it, error message "fatal error lnk1112: module machine type 'x64' conflicts target machine type 'x86'".

i have tried convert platform x64, didn't work. please tell me: "module machine type" , "target machine type"? how can overcome it?

i wrote blog entry this, encountered maddening problem, , yanked system working order.

these things check, in order:

  1. check properties options in linker settings at: properties > configuration properties > linker > advanced > target machine. select machinex64 if targeting 64 bit build, or machinex86 if making 32 bit build.

  2. select build > configuration manager main menu in visual studio. make sure project has correct platform specified. possible ide set build x64 individual project in solution can set target win32. yeah, visual studio leaves lot of rope hang yourself, that's life.

  3. check library files of type of platform targeting. can used using dumpbin.exe in visual studio vc\bin directory. use -headers option dump functions. machine entry each function. should include x64 if it's 64 bit build.

  4. in visual studio, select tools > options main menu. select projects , solutions > vc++ directories. select x64 platform dropdown. make sure first entry is: $(vcinstalldir)\bin\x86_amd64 followed $(vcinstalldir)\bin.

once did step 4 worked again me. thing was encountering problem on projects wanted compile towards 64 bit target.


Comments