fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86&#

VS2008 + CUDA2.3 TOOLKIT

i wrote a program that in x64 mode, it has no problem.
but if i choose win32 mode, the compile error appears.

i had set the VC++ directories( include execute lib ), and set configuration manager all right.
what is the problem?

Hi. There are several places you want to look in to make sure everything is set all right.

First, select the solution, and open properties window. In Configuration properties > Linker > Input > Additional dependencies make sure that you have right version of libs included (cutil64.lib for x64 system and cutil32.lib for x86).

Second, make sure that in Target machine Configuration properties > Linker > Advanced is set correctly.

Third, choose properties of the source code file whose object file causes error, and go through them to make sure that it is set to compile for requested type of machine (if there are such options, it depends on CUDA build rule you use if I’m not mistaken)

How did you “choose wi32 mode”? Did you create new configuration with all properties copied from x64 configuration?

thank you for replying.

I installed 64-bit toolkit, so nvcc.exe is in my “D:/cuda/bin64” directory. This is my CUDA build command line:

 “d:\cuda\bin64\nvcc.exe” -arch sm_10 -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin” -Xcompiler "/EHsc /W3 /nologo /O2 /Zi /MT " -maxrregcount=32 --compile -o “Debug\ZoomCmp.cu.obj” “e:\HOME\GOGDIZZY\Projects\GTest\ZoomCmp\ZoomCmp.vcproj”

and this is my C/C++ compile command line:

/Od /D “WIN32” /D “_DEBUG” /D “_CONSOLE” /D “_UNICODE” /D “UNICODE” /Gm /EHsc /RTC1 /MDd /Fo"Debug\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

and this is linker command line:

/OUT:“E:\HOME\GOGDIZZY\Projects\GTest\Debug\ZoomCmp.exe” /INCREMENTAL /NOLOGO /LIBPATH:“D:\CUDA\lib” /MANIFEST /MANIFESTFILE:“Debug\ZoomCmp.exe.intermediate.manifest” /MANIFESTUAC:“level=‘asInvoker’ uiAccess=‘false’” /DEBUG /PDB:“E:\HOME\GOGDIZZY\Projects\GTest\Debug\ZoomCmp.pdb” /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT cuda.lib cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

I don’t know if the nvcc compile the zoom.cu file to a x64 module file zoom.cu.obj such that it can not link

with other object files…

And i’m sure the configuration manager’s item i set right.

 i download a 32-bit toolkit and it worked,i don’t know if there’s sth wrong with 64-bit toolkit.

i think it should be compatible with 32-bit.

Thanks.

Try to use --machine flag while compiling your .cu file with nvcc.

nvcc help tells us

[codebox]–machine (-m)

    Specify 32 vs 64 bit architecture.

    Allowed values for this option:  32,64.

    Default value:  64.[/codebox]

Thank you very much !!

I think i can understand this issue after your advice.

Could you tell me how to do ? I follow this link and change Target Machine property to MachineX64 (/MACHINE:X64), still doesn’t work, could you tell how did you fixed this?

http://msdn.microsoft.com/en-us/library/5wy54dk2.aspx

i solved it with changing under project->properties->configuration properties->Runtime API->Host->Target Machine Platform , this you need to set to x64