sr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start'問題解決

2puT發表於2016-07-08

自己寫了一個簡單的hello.c

 

 

#include "stdio.h"

 

 

void

hello (const char * name)

{

printf ("Hello, %s!/n", name);

}

 

$gcc hello.c

就會出現/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start'

:

(.text+0x20): undefined reference to `main'

collect2: ld returned 1 exit status

 

解決方法:只要把hello函式名改為main就沒錯了! 最好主函式名為main

 

 

 

#include "stdio.h"

 

void

main (const char * name)

{

printf ("Hello, %s!/n", name);

}

 

$gcc hello.c

 

ok!

 

相關文章