在Visual Studio 2012中跟踪LNK1112错误 [英] Tracing LNK1112 error in Visual Studio 2012

查看:99
本文介绍了在Visual Studio 2012中跟踪LNK1112错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目已经作为x64项目进行了一段时间的编译,但是由于种种原因,我现在必须将其编译为x86项目.

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.

我遇到的问题是,每次编译项目时,我现在都会收到LNK1112错误.

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.

Release \ CameraCapture.obj文件是从属于我的项目的.cpp文件编译而成的.

The file Release\CameraCapture.obj is compiled from a .cpp file that is part of my project.

我已经删除了项目中所有其他的.lib依赖项,以试图消除我错过获得任何第三方库的32位版本的任何可能性.剩下的就是默认情况下添加到项目中的Windows库.

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.

我想知道有什么方法可以专门跟踪LNK1112错误所涉及的文件吗?显然涉及到CameraCapture.obj,但是此文件应该是x86,没有任何问题.有人对如何解决我遇到的问题有任何好的提示吗?

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?

推荐答案

一些解决此类问题的技巧:

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.

确保在项目设置中设置了正确的平台类型.我什至会在.vcxproj文件本身中搜索x64和x86,以确保您捕获了所有内容.

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.

使用dumpbin /HEADERS检查进入链接器的.obj和.lib文件的计算机类型.

Use dumpbin /HEADERS to check the machine type of the .obj and .lib files going into the linker.

这篇关于在Visual Studio 2012中跟踪LNK1112错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆