所以我尝试运行.s文件,每次使用命令行时: gcc -m32 -o Compute32 Compute.s 我收到了这个错误:
Undefined symbols for architecture i386: "_main", referenced from: implicit entry/start for main executable "printf", referenced from: main in Compute-f6f555.o "scanf", referenced from: main in Compute-f6f555.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation
有人可以告诉我下一步吗?
答案 0 :(得分:0)
我只能猜测,因为你没有告诉我你的Compute.s
,但我想你的问题是在OS X上,所有C函数都在汇编中以下划线为前缀。因此,如果您将main
更改为_main
,同样将printf
更改为_printf
等,则应解决您的问题。