undefined reference to 'main'

馒头小子 2012-11-14 10:33:19
#include<stdio.h>
void main()
{
printf("hello word!\n");
}
文件名是1.c 在redhat中 用gcc 2.c -o 2 提示undefined reference to 'main'
这是为什么,我昨天还可以编译的,而且今天也能编译昨天的程序,求指导
...全文
166 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Primitive_forest 2012-11-15
  • 打赏
  • 举报
回复
你自己已经解决了
JiMoKuangXiangQu 2012-11-14
  • 打赏
  • 举报
回复
#include <stdio.h>
int main(void)
{
   printf("hello word!\n");
   return 0;
}
试试这样看看.
转角天边 2012-11-14
  • 打赏
  • 举报
回复
改成标准格式试试 int main(int argc,char *argv[]) { printf("helloworld\n"); return 0; }
馒头小子 2012-11-14
  • 打赏
  • 举报
回复
写错了,文件名是2.c

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧