ld:体系结构x86_64的未定义符号

时间:2015-07-04 16:25:25

标签: assembly executable nasm x86-64 ld

我做了一个这样的nasm程序集hello world程序:

global start


section .text

start:
    mov rax, 0x20000004
    mov rdi, 1
    lea rsi, [rel msg]
    mov rdx, msg.len
    syscall

    mov rax, 0x20000001
    mov rdi, 0
    syscall


section .data

msg:    db  "Hello, World!", 10
.len:   equ $ - msg

执行nasm -f macho64 print.asm的确很好,但ld -macosx_version_min 10.10 -o print print.o会出现如下错误:

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for inferred architecture x86_64

我不知道这意味着什么:)。有人可以帮我解决这个问题吗?谢谢!附:我在OS X Yosemite上使用Mac。

0 个答案:

没有答案
相关问题