assembly - 将 64 位 NASM 与 MinGW-64 链接会导致“文件格式无法识别”错误
问题描述
我正在尝试使用 MinGW-64bit 和以下批处理命令在 Windows 上组装和链接 64 位 NASM 程序:
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,但我仍然得到了 32 位版本,因为我在安装时选择了 i686 选项。我使用“x86-64”选项重新安装并解决了问题。
推荐阅读
- spring - 春季集成:消息未从生产者端点传递到消费者端点
- android - UtteranceProgressListener 整体工作,但事件 onStart 和 onDone 不起作用
- c# - 状态机和网络套接字 - 如何处理竞争条件
- servicestack - 添加到 ExportTypes 时未在 DTO 上生成指定类型
- tensorflow - 在heroku上构建张量流时出错
- javascript - img src 返回未定义
- python - Gitlab-ci 不识别 python
- c# - 如何在 Windows 和 Linux 系统上使用 Avalonia 框架处理系统关闭事件?
- python - 使用 Python 类创建 Stripe 对象和处理错误的最佳方式
- python - 为什么我可以返回完整的查询结果,但不能返回指定的项目?