1
我已經寫了一個.s程序女巫必須在顯示器上打印一個小字符串。 然後我打開窗戶上的10和Linux的bash的完成:在Windows Bash上執行程序嗎?
as -o file.o file.s
ld -o file file.o
./file
,但它不顯示任何信息 爲什麼?我試圖在Linux虛擬機上相同的代碼,它工作
的文件時,它是一個簡單的「Hello World」在學校裏學大會
.section .data
hello:
.ascii "Hello, World!\n"
hello_len:
.long . - hello
.section .text
.global _start
_start:
movl $4, %eax
movl $1, %ebx
leal hello, %ecx
movl hello_len, %edx
int $0x80
movl $1, %eax
xor %ebx, %ebx
int $0x80
你是否收到錯誤信息?你在linux vm或wsl上編譯了目標文件嗎? – Aserre
Linux代碼不能在Windows中運行。訪問操作系統以打印內容不同。 – Jester
我在linux vm和windows中編譯目標文件,它不會給出任何錯誤。當我在Linux中執行時,我可以看到終端中的字符串,但在Windows中它不打印;它返回文件路徑 –