如何解决模块机器类型'X86'与目标机器类型'x64'Visual Studio冲突

use*_*774 19 visual-studio visual-c++ visual-studio-2015

我正在编译我需要在python脚本中使用的Openssl库.我正在使用Visual Studio 2015 Developer命令提示符.我的机器是Windows 7 64位.

当我输入命令时: nmake -f ms\ntdll.mak

我收到此错误:

tmp32dll\uplink.obj : fatal error LNK1112: module machine type 'X86' conflicts w
ith target machine type 'x64'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\BIN\amd64_arm\link.EXE"' : return code '0x458'
Stop.
Run Code Online (Sandbox Code Playgroud)

我搜索了几个类似问题的解决方案建议从项目设置中更改项目平台.我没有VS项目.我正在运行所有这些命令只是为了编译OpenSSL库.我正在使用VS命令.

请帮我.

Mer*_*avi 25

我遇到了同样的问题 - 只是VS2013.

我遇到过两种方法,可能会对您的情况有所帮助,也可能没有帮助:

第一种方法

(可能仅适用于VS2013及以上版本)

打开"VS2015 x64 Native Tools命令提示符"并在那里执行命令.

 Note:
 If you get the opposite message:
 module machine type 'x64' conflicts with target machine type 'x86' 
 then you should open the 'VS2015 x86 Native Tools Command Prompt' 
Run Code Online (Sandbox Code Playgroud)

这两个工具都可以在文件夹下找到:

C:\ Program Files(x86)\ Microsoft Visual Studio 14.0\Common7\Tools\Shortcuts

第二种方法

(可能仅与VS2013之前的版本相关)

在VS2015的Developer Command Prompt中,您可以通过运行以下命令来更改编译器目标平台

"C:\ Program Files(x86)\ Microsoft Visual Studio 15.0\VC\vcvarsall.bat x64"

"C:\ Program Files(x86)\ Microsoft Visual Studio [VS Version]\VC\vcvarsall.bat [Target Platform]"

对于VS 2017

"C:\ Program Files(x86)\ Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat [Target Platform]"

Note:
VS Version: 10.0|11.0|12.0|15.0|... 
Target Platform: x86|amd64|x64|arm|x86_arm|x86_amd64|amd64_x86|amd64_arm|amd64_x86
*leaving the target platform empty will default to x86
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,启动x86 32位Visual Studio shell解决了我在Windows 10上编译32位openssl的问题.错误消息是:crypto\aes\aes_cfb.obj:致命错误LNK1112:模块机器类型'x64'与目标机器冲突输入'X86' (2认同)
  • 对于VS 2017,可以在“ C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Enterprise \ VC \ Auxiliary \ Build”中找到vcvarsall.bat。 (2认同)

V-R*_*V-R 6

此错误意味着它tmp32dll\uplink.obj是32位二进制文​​件,而链接程序预期它是64位,因为它的目标是64位。

看起来您需要将其重新编译为64位,或仅执行全部重建(或删除全部*.obj甚至整个二进制输出目录)

如果构建过程中断,然后您更改目标平台,然后以增量方式重复构建过程,则会发生这种情况。32位不会与64位混合使用,因此它完全是一种方法。

  • 我不知道如何使openssl干净,但是我手动删除了所有* .obj文件,这似乎可以解决问题。 (2认同)