msvcprtd.lib(MSVCP100D.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' - c++

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?

In the project Library Directories, be sure you change
$(VCInstallDir)lib and $(VCInstallDir)atlmfc\lib
to
$(VCInstallDir)lib\amd64 and $(VCInstallDir)atlmfc\lib\amd64

After searching I came across an useful page MSDN Info. "It is a known problem that on occasions VC picks up certain settings from older versions of VC installed and causes these kinds of problems."

For me it worked by adding the following:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64
Anyway, don't hesitate to search the msvcprtd.lib file directly from Visual Studio installation directory.

I have faced same problem.It comes rarely and occasionally when we create new project for X64 platform.
Here is the solution: for X64 platform
In Configuration properties-->
1.Include directories -> $(VCInstallDir)PlatformSDK\include;$(IncludePath);
2.Library directories -> $(VCInstallDir)PlatformSDK\lib;$(LibraryPath);

Related

How could I migrate a win32 application to a x64 one?

Recently I worked on a facial recognition application in Visual Stuido 2015. In order to apply cuda libraries to the app, this app needs to migrate from win32 type to x64. I carefully change the configuration manager and moderate everything involved with x86 when making sure every extern dll or lib has its x64 version.
But after compiled in release mode, there is always a error message: "LNK1112 module computer type 'x86' conflicts target computer type 'x64'". The error file is CameraDS.obj which is written by directshow. And I checked the producing .obj files with dumpbin /headers, then discovered the header file values of every .obj is machine (x86). Delete these .obj files or just clean solution doesn't work, and the IDE just throws the same error message. I don't konw why.
Is there any solution?
Is it the source of the lib CameraDS.obj?
https://github.com/souseiki/Stereo-Vision
Just recompile it for x64 as well.
Also check that you haven't left x86 anywhere, look at the answers of fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

Qt module error - LNK 1112 in QtOpenGL

I am trying to build a project (x64) connected with Qt library in Microsoft Visual Studio 2010. The project I want to compile was built using Visual Studio 2008.
I have all the dependencies added, downloaded compiled the Qt library 64-bit and done all the proper changes in project properties in VS 2010. Although, I get the error below:
Error 2616 error LNK1112: module machine type 'X86' conflicts with
target machine type 'x64' D:\project\Windows\QtOpenGL4.lib(QtOpenGL4.dll)
I have checked my .dll and .lib files and they are an in x64 bit version. Also, my QtOpenGL4.dll file is in another path from the one mentioned in error.
Could it be an error from the QtOpenGL4 module? How could I solve this? Could you please help me?
The instructions I followed in order to build the 64-bit version of Qt are in this link : https://en.wikibooks.org/wiki/Opticks_Developer_Guide/Getting_Started/Building_Qt_From_Source
Finally I found a solution in my error. I compiled again the Qt library in 64-bit and entered all the proper values in project Properties. I also entered the proper path in
Project Properties -> Linker ->Input ->Additional Dependencies.
With the right paths it solved the linkage error for me.
I have to mention that I also downloaded the precompiled libraries from the answers in this link
How to compile Qt for 64-bit Windows from a 32-bit environment with Visual C++ 2010 Express?
You are probably trying to link your 64-bit project with 32-bit Qt libraries.
This says more about the error you are facing.
Similarly, if you create one module with the x64 compiler and another
module with the x86 compiler, and try to link them, the linker will
generate LNK1112.
Check if you are using 64-bit precompiled Qt libraries.

Failing to build Boost 1.60.0 on Windows 10

I've used the Getting Started Guide that is provided from Boost.
Many of the existing problems with somewhat related nature seem to occur within Visual Studio and be due to faulty project settings and linking in particular.
My problems lies in actually getting Boost to build using the Developer Command Prompt for VS2015 and running it as admin.
First I just extracted the folder and ran the VS2015 command prompt from the root folder with
bootstrap.bat
which gave me the following output
C:\Program Files (x86)\boost\boost_1_60_0>bootstrap.bat
Building Boost.Build engine
Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.
You can try to obtain a prebuilt binary from
http://sf.net/project/showfiles.php?group_id=7586&package_id=72941
Also, you can file an issue at http://svn.boost.org
Please attach bootstrap.log in that case.
According to the bootstrap.log a lot of required header files were not found. According to the Visual C++ Team Blog the headers, sources and librares is now distributed on a different location on the user machines. This happend to me! I had to move a ton of headers and lib files from for it to find them.
However..... I can't figure out how to go on from this point.
Looking at your output at the end there are 4 suspicious warnings:
..\kernel32.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
..\advapi32.lib: warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
..\user32.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
..\uuid.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'X86'
Note the machine type, i.e. it probably related to which platform this is running for. Visual Studio Command Prompts come in different forms, make sure that you are running the correct one - In your case the correct one seems to be the VS2015 x64 Native Tools Command Prompt

Issue while compiling in X64 with SFML in visual studio

When I try compiling my project in X64 I always have the same error :
LNK1112: module machine type 'x64' conflicts with target machine type 'X86
I've already test all the solutions I found but i can't figure it out
my VC++ directory is fine :
$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmf\lib\amd64;$(WindowsSDK_LibraryPath_x64);
I've properly link the 64 bits version of the SFML in the C/C++ menu and in the linker...
Do you guys know why it's still throwing this ?
Go to your project property page, in "Linker -> Advanced", switch "Target Machine" to "MachineX64 "

Trouble to compile a native c++ program in 64 bits

I try to compile a native Visual Studio 2008 C++ program in 64 bits on my windows 32 bits.
I have an error during the link because the version of msvcprtd.lib in 64 bits is not found.
msvcprt.lib(MSVCP90.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
I have installed the last version of Microsoft Windows SDK but I can't found the msvcprtd.lib file in x64 directory.
This error is likely due to not having the library directories set up to reference the x64 ones. This can easily happen if you add a new x64 configuration to a project. The simplest solution is to create a new solution with project for both win32 and x64 and then look at the VC++ Directories/Library Directories in the project properties, and ensure the ones you have in your project are the same.
msvcprtd.lib doesn't appear in my latest SDK in either 32 or 64 bits. I do see it in version 5.0 of the SDK though, but only for the IA64 platform type.
Perhaps that lib simply doesn't exist. Try removing it from the list of lib's you're linking against and see what errors you get then, googling those errors may lead you to the name of the lib you actually want to link.
Try this: Go to your project property -> Configuration Manager and then create a configuration manager which specifies x64 as platform and set it as active.
My short answer is did you make sure you have the cross complier installed. I remember going crazy when trying to compiled a 64 bit binary on my 32 bit XP, when I realized I did not have the cross compiler installed. (Having my Visual studio media handy is helpful).
Also as Madhur said make sure your Configuration is set for 64 bit.