C++ – msvcprtd.lib(MSVCP100D.dll) : fatal error LNK1112: module machine type ‘X86’ conflicts with target machine type ‘x64’

64-bitcvisual studio 2010windows

I created a vs 2010 win 32 program (Operation system: Win 8-64bit)

Then, I tried to convert this win32 program in to x64 by doing like this:

 Configuration Manager -> new solution platform (select x64) -> copy settings from win32

The vs2010 created a new x64 program based on the previous win32 program.

However, when I tried to compile and run the x64 program, there is a single error:
msvcprtd.lib(MSVCP100D.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

By renaming both win32 version and x64 version of msvcprtd.lib, I found the program is still using the win32 msvcprtd.lib.

I checked and found msvcprtd.lib is in $(VCInstallDir)lib\amd64. Moreover:

Library Directories -> Inherited values has included all the necessary directories (I think):

$(VCInstallDir)lib\amd64
$(VCInstallDir)atlmfc\lib\amd64
$(WindowsSdkDir)lib\x64

I also checked the 3rd party libraries and dlls the program is using are of x64 version.

My question is why the program is still using the win32 msvcprtd.lib and how to solve this problem?

Best Answer

In the project Library Directories, be sure you change

$(VCInstallDir)lib and $(VCInstallDir)atlmfc\lib

to

$(VCInstallDir)lib\amd64 and $(VCInstallDir)atlmfc\lib\amd64

Related Topic