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

1 什么是“module machine type”

这个是当前工程要链接的静态库的target machine type。

2 什么是“target machine type”

这个是当前工程生成的目标的target machine type。

3 在windows上如何查看静态库的machine type

使用dumpbin /ALL 会生成关于该静态库的所有信息,然后每个具体的文件的信息头中有machine信息。

4 该link error如何解决

4.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.

4.2 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.

4.3 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.

原文地址:https://www.cnblogs.com/hustdc/p/6834627.html