关闭

VC9: LINK : warning LNK4068: /MACHINE not specified; defaulting to X86

标签: x86linkerinstallermanagercompilerdialog
6301人阅读 评论(0) 收藏 举报
分类:

当把32位程序改成X64的配置编译后,可能会出现错误:

fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' 

通常是因为某些编译单元被编译成了X86的机器码,进一步的原因是编译选项中缺少
/MACHINE,默认会选择X86;在属性中的link面板中加入/MACHINE:X64
即可。

 

The error is explicit, you are trying to link libraries that were compiled with different CPU targets. An executable image can only contain pure x86 (32-bit) or pure x64 (64-bit) code. Mixing is not possible.

You change the target CPU by creating a new configuration for the project, only changing the linker setting isn't enough. Build + Configuration Manager, Active solution platform combo on upper right, choose New and select x64. That creates a new configuration with several modified project settings, most importantly the compiler that will be used.

Beware that prior to VS2010, the 64-bit compilers are not installed by default. If you don't see x64 in the platform combo then you'll need to re-run setup.exe and turn on the option to install the 64-bit compilers. Then also re-run any service pack installer you may have applied.

A possible approach with less pain points is to use the 32-bit version of the library.

bumped into this too and found a solution.

First on how I got into this problem. I have a project which builds in x86. Then I use the Configuration Manager to add x64, and I hit this problem.

By looking at BuildLog.htm carefully, I see both of these listed as linker options: /MACHINE:X64
/machine:X86

I can't find any where in the Property Pages dialog where I can change this, so I open up the .vcproj file and look for the appropriate line and change it to: AdditionalOptions=" /STACK:10000000 /machine:x64 /debug"

 

0
0

猜你在找
【套餐】Hadoop生态系统零基础入门
【套餐】嵌入式Linux C编程基础
【套餐】2017软考系统集成项目——任铄
【套餐】Android 5.x顶级视频课程——李宁
【套餐】深度学习入门视频课程——唐宇迪
【直播】广义线性模型及其应用——李科
【直播】从0到1 区块链的概念到实践
【直播】计算机视觉原理及实战——屈教授
【直播】机器学习之凸优化——马博士
【直播】机器学习&数据挖掘7周实训--韦玮
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1241625次
    • 积分:12276
    • 等级:
    • 排名:第1154名
    • 原创:89篇
    • 转载:472篇
    • 译文:2篇
    • 评论:114条
    文章分类
    最新评论