sr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start'问题解决

来源:互联网 发布:日韩男士帽子 知乎 编辑:程序博客网 时间:2024/05/20 20:21

自己写了一个简单的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!

 

0 0
原创粉丝点击