您的位置:首页 > 运维架构 > Linux

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

2016-07-08 09:39 483 查看
自己写了一个简单的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!

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: