将 64 位 NASM 与 MinGW-64 链接会导致 "File format not recognized" 错误
Linking 64-bit NASM with MinGW-64 causes "File format not recognized" error
我正在尝试 assemble 和 link Windows 上的 64 位 NASM 程序,使用 MinGW-64 位和以下批处理命令:
nasm -f win64 HelloWorld.asm && "C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gcc.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,但由于我在安装时选择了i686选项,所以我得到的仍然是32位版本。我使用 "x86-64" 选项重新安装并解决了问题。
我正在尝试 assemble 和 link Windows 上的 64 位 NASM 程序,使用 MinGW-64 位和以下批处理命令:
nasm -f win64 HelloWorld.asm && "C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gcc.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,但由于我在安装时选择了i686选项,所以我得到的仍然是32位版本。我使用 "x86-64" 选项重新安装并解决了问题。