问题
I have a project that I have been compiling as an x64 project for quite some time, but for various reasons I have to compile it as an x86 project now.
The problem I have run in to is that every time I compile the project I now get a LNK1112 error.
1>Link:
1>
1> Starting pass 1
1>Release\CameraCapture.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
1>
1>Build FAILED.
The file Release\CameraCapture.obj is compiled from a .cpp file that is part of my project.
I have removed every additional .lib dependency in my project just to try to eliminate any possibility that I had missed getting the 32 bit version of any 3rd party libraries. All that is left is the Windows libraries that are added to projects by default.
I want to know is there any way to trace specifically which files are involved with the LNK1112 error? Obviously the CameraCapture.obj is involved, but this file should be x86 and not have any problems. Does anyone have any good tips on how to approach finding the problem I am having?
回答1:
Some tips for dealing with this sort of problem:
Turn on the linker startup banner so you can see exactly what inputs it is using (or look at the command line in the project properties.
Make sure the project is clean so there aren't any old binaries laying around.
Make sure you have the proper platform type set in your project settings. I'd even go so far as to search for x64 and x86 in the .vcxproj files themselves to make sure you caught everything.
Use
dumpbin /HEADERS
to check the machine type of the .obj and .lib files going into the linker.
来源:https://stackoverflow.com/questions/13980082/tracing-lnk1112-error-in-visual-studio-2012