链接问题:致命错误LNK1112:模块机器类型'x64'与目标机器类型'X86' [英] linking problem: fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
问题描述
我试图从wxFreeChart库运行示例应用程序。上联有编译后的错误:
Im trying to run sample app from wxFreeChart library. After compilation on linking there is an error:
wxcode_msw28d_freechart.lib(wxfreechart_lib_xydataset.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
我试图切换连接option\advanced\目标机MachineX64,但它不工作。
I tried to switch linker option\advanced\target machine to MachineX64 but it doesnt work.
即时通讯使用Visual Studio 2008,有何建议?
Im using visual studio 2008, any suggestion ?
感谢帮助
推荐答案
该错误是明确的,您要链接,分别用不同的CPU为目标编译库。可执行映像只能包含纯x86(32位)或纯x64(64位)代码。混合是不可能的。
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.
您通过为项目创建一个新的配置,只需更改链接器设置中更改目标CPU是不够的。 Build + Configuration Manager,右上角的主动解决方案平台组合,选择New并选择x64。创建具有几个修改项目设置,最重要的将要使用的编译器的新配置。
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.
要注意的是之前VS2010,64位编译器的不是默认安装。如果你没有看到在平台组合64,那么你就需要重新运行setup.exe并打开相应的选项来安装64位编译器。然后又重新运行您可能已应用的任何服务包安装程序。
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.
痛苦少点一个可能的方法是使用库的32位版本。
A possible approach with less pain points is to use the 32-bit version of the library.
这篇关于链接问题:致命错误LNK1112:模块机器类型'x64'与目标机器类型'X86'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!