日期:2014-05-16  浏览次数:20867 次

gcc编译 出现错误(.text+0x20): undefined reference to `main' collect2: ld 返回 1
编译的是很简单的hello world

#include <stdio.h>
int main(void)
{
    printf("Hello, world!\n");
    return 0;
}

用过各种编译
gcc -o test test.c
gcc -g -Wall test.c -o test
也不是很明白是什么意思
就是想至少能先输出hello wrold
新人不懂,求指点

------解决方案--------------------

//把这个复制上次再运行一边看看 ,我运行是OK的
#include <stdio.h>
int main(void)
{
    printf("Hello, world!\n");
    return 0;
}