看板 ASM 關於我們 聯絡資訊
原始檔有兩個main1.c square.s //main1.c #include<stdio.h> extern int square(int i); int main(void) { int i; for (i=0;i<10;i++) { printf("Square of %d is %d\n",i,square(i)); } } @square.s .text .global square square: MUL r1,r0,r0 @ r1 = r0 x r0 MOV r0,r1 @ r0 = r1 MOV pc,lr @ return r0 .end 編譯步驟與錯誤訊息如下 [leo@localhost main]$ ls main1.c square.s [leo@localhost main]$ gcc -c main1.c [leo@localhost main]$ as -o square.o square.s [leo@localhost main]$ ls main1.c main1.o square.o square.s [leo@localhost main]$ ld -o main1 main1.o square.o ld: warning: cannot find entry symbol _start; defaulting to 00008074 main1.o: In function `main': main1.c:(.text+0x34): undefined reference to `printf' 請問是哪裡的寫法不對?先謝謝各位 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.155.213
Miayi:FD'FL'SDLF;L'DFS;'FSDLDF'LSDLF;SDLSD'LSDLF'DLFD;SFDL';SD 03/04 13:59
Miayi:FKL;SDKFLSD'FDLS;'SDFL';SDLFD';FLDS'FSDL'LFDS';SDFLFD'; 03/04 13:59
Miayi:FK;DSLFKDL;KFL;SDKFDL;KDFL;FDKDL;KF;LKDL;FKDSL;FDK;DK;L 03/04 13:59
guteres:樓上..? 03/05 09:14
loveflames:一樓是來亂的? 03/06 20:58
loveflames:square.s我在SunOS下組譯出錯 03/07 01:42