linking problem: fatal error LNK1112: module machine type #39;x64#39; conflicts with target machine type #39;X86#39;(链接问题:致命错误 LNK1112:模块机器类型“x64与目标机器类型“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'
我尝试将链接器选项高级目标机器切换到 MachineX64,但它不起作用.
I tried to switch linker optionadvanced arget 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,仅更改链接器设置是不够的.构建 + 配置管理器,右上角的活动解决方案平台组合,选择新建并选择 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 位编译器.如果您在平台组合中没有看到 x64,那么您需要重新运行 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"冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:链接问题:致命错误 LNK1112:模块机器类型“x64"与目标机器类型“X86"冲突


基础教程推荐
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 常量变量在标题中不起作用 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01