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

时间:2024-01-18 15:02:08

xxxxxx.lib(xxxxxx.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

1. 先看看你的模块是否是64位,这个一般都是,如何配置64位工程,这里就不说了;

2. 查看该模块链接的静态库或者dll是否是64位的;

Configuration-->kinker-->General-->Additional Library Directories 看看是链接到64位的目录;

Configuration-->kinker-->input-->Additional Dependencies  中的库是否都是64位;

3. 看看你链接的库是否都按64位编译的,临时文件,目标文件是否生成到64位目录;

4. 看看你链接的静态库:

Configuration-->Librarian-->General-->Additional Dependencies

Configuration-->Librarian-->General-->Additional library Directories

是否有依赖32位内容,其实静态库不需要链接静态库,我就是因为静态库去依赖了32位的,导致64位模块编译失败。

5. 最后实在不行试试改这个地方:

Configuration-->Preprocessor-->Preprocessor Definitions-->WIN32改为_WIN64

总结:

xxxxxx.lib(xxxxxx.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

这个错误提示想告诉你的是,该64位模块依赖了32位的东西,确保你依赖的库都是32位,并且依赖的库没有包含别人32位的东西。