致命错误 LNK1112:模块机器类型“x64"与目标机器类型“X86"冲突 [英] fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

查看:22
本文介绍了致命错误 LNK1112:模块机器类型“x64"与目标机器类型“X86"冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 CUDA(VC++、Visual Studio 2008sp1)来调试 FEM 程序.由于cuda的不足,该程序只能在Win32平台上运行.我认为链接的库文件都是在x86平台上编译的,但是当我编译它时,我收到错误消息致命错误LNK1112:模块机器类型'x64'与目标机器类型'X86'冲突".

I'm using CUDA (VC++, Visual studio 2008sp1) to debug a FEM program. The program can only run on a Win32 platform, for the insufficiency of cuda. I think the library files linked are all compiled on the x86 platform, but when I compile it, I get the error message "fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'".

我尝试将平台转换为 x64,但没有成功.请告诉我:什么是模块机器类型",什么是目标机器类型"?我怎样才能克服它?

I have tried to convert the platform to x64, but it didn't work. Please tell me: what is "module machine type" and what is "target machine type"? How can I overcome it?

推荐答案

我写了一个博客 关于此的条目,因为我遇到了这个令人抓狂的问题,最后使我的系统恢复了工作状态.

I wrote a blog entry about this, as I encountered this maddening problem, and finally yanked my system back into working order.

这些是要检查的东西,按顺序:

These are the things to check, in this order:

  1. 检查链接器设置中的属性选项:属性 > 配置属性 > 链接器 > 高级 > 目标机器.如果您的目标是 64 位构建,请选择 MachineX64,如果您要构建 32 位构建,请选择 MachineX86.

  1. Check your properties options in your linker settings at: Properties > Configuration Properties > Linker > Advanced > Target Machine. Select MachineX64 if you are targeting a 64 bit build, or MachineX86 if you are making a 32 bit build.

从 Visual Studio 的主菜单中选择 Build > Configuration Manager.确保您的项目指定了正确的平台.IDE 可以设置为构建 x64,但解决方案中的单个项目可以设置为目标 win32.所以是的,visual studio 留下了很多绳索来吊死自己,但这就是生活.

Select Build > Configuration Manager from the main menu in visual studio. Make sure your project has the correct platform specified. It is possible for the IDE to be set to build x64 but an individual project in the solution can be set to target win32. So yeah, visual studio leaves a lot of rope to hang yourself, but that's life.

检查您的库文件,它们确实是所针对的平台类型.这可以通过使用 Visual Studio VCin 目录中的 dumpbin.exe 来使用.使用 -headers 选项转储所有函数.查找每个功能的机器条目.如果是 64 位版本,它应该包括 x64.

Check your library files that they really are of the type of platform are targeting. This can be used by using dumpbin.exe which is in your visual studio VCin directory. use the -headers option to dump all your functions. Look for the machine entry for each function. it should include x64 if it's a 64 bit build.

在 Visual Studio 中,从主菜单中选择工具 > 选项.选择项目和解决方案 > VC++ 目录.从平台下拉列表中选择 x64.确保第一个条目是:$(VCInstallDir)inx86_amd64 后跟 $(VCInstallDir)in.

In visual studio, select Tools > Options from the main menu. select Projects and Solutions > VC++ Directories. Select x64 from the Platform dropdown. Make sure that the first entry is: $(VCInstallDir)inx86_amd64 followed by $(VCInstallDir)in.

一旦我完成了第 4 步,一切又对我有用了.问题是我在我想要编译为 64 位目标的所有项目中都遇到了这个问题.

Once I did step 4 everything worked again for me. The thing was I was encountering this problem on all my projects where I wanted to compile towards a 64 bit target.

这篇关于致命错误 LNK1112:模块机器类型“x64"与目标机器类型“X86"冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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