GCC编译C程序需要注意文件名后缀的问题

来源:互联网 发布:快递不送货上门 知乎 编辑:程序博客网 时间:2024/05/01 04:41

            使用gcc编译c程序时,源程序的文件名后缀必须是.c,否则会报错,比如我写了一个测试程序叫test.cc,只有一个空的main函数,
#include
#include
int main(void)
{
    return 0;
}

           使用gcc –o test mytest.cc编译报错:
/tmp/cc6N9Ewi.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

            文件名改成mytest.c再编译就没有问题了。
原创粉丝点击