将 64 位 NASM 与 MinGW-64 链接会导致"File format not recognized"错误



我正在尝试使用以下批处理命令使用 MinGW-64 位在 Windows 上组装和链接 64 位 NASM 程序:

nasm -f win64 HelloWorld.asm && "C:Program Files (x86)mingw-w64i686-8.1.0-posix-dwarf-rt_v6-rev0mingw32bingcc.exe" HelloWorld.obj -o HelloWorld.exe

但是我收到此错误:

HelloWorld.obj: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status

我该如何解决这个问题?

事实证明,尽管我下载并安装了MinGW-64,但我仍然获得了32位版本,因为我在安装时选择了i686选项。 我重新安装了"x86-64"选项,它解决了问题。

相关内容

最新更新