SASM 程序集 IDE 64 示例编译错误“地址大小的不可能组合”关于 PRINT_STRING 消息

问题描述 投票:0回答:1

我在 Windows 7 64 位上,我从这里下载了 SASM 程序集 IDE:

https://dman95.github.io/SASM/english.html

包括几个你好世界的例子。 NASM 示例编译正常,但 NASM 64 位给出编译错误。

NASM 64 位代码是:

%include "io64.inc"

section .data
    msg db 'Hello, world!', 0

section .text
    global CMAIN
CMAIN:
    mov ebp, esp; for correct debugging
    mov rbp, rsp
    PRINT_STRING msg
    NEWLINE
    xor rax, rax
    ret

编译错误为:

Build started...
Warning! Errors have occurred in the build:
C:\Temp\SASM\program.asm:11: error: impossible combination of address sizes
C:\Temp\SASM\program.asm:11: error: impossible combination of address sizes
C:\Temp\SASM\program.asm:11: error: impossible combination of address sizes
C:\Temp\SASM\program.asm:12: error: impossible combination of address sizes
C:\Temp\SASM\program.asm:12: error: impossible combination of address sizes
C:\Temp\SASM\program.asm:12: error: impossible combination of address sizes
gcc.exe: error: C:\Temp\SASM\program.o: No such file or directory

为什么我会收到此错误/发生了什么,以便我可以理解以及如何解决它?

assembly x86 nasm sasm
1个回答
1
投票

当我第一次尝试将 SASM 作为 NASM 的 IDE 时,我收到了这些相同的错误消息。问题是 SASM 有两种模式,x86 和 x64。这些模式在“设置”的“选项”选项卡中设置。 “开箱即用”模式设置为 x86。要编译 x64 示例,您必须选择 x64 模式。选中 x64 后,NASM 的 64 位示例将正确组装和运行。

© www.soinside.com 2019 - 2024. All rights reserved.