undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit stat

来源:互联网 发布:ubuntu dd iso 安装盘 编辑:程序博客网 时间:2024/05/22 12:15

如标题错误,在编译如下代码的时候遇到的,经google得知,我用C编译器去编译C++代码造成的。

gcc C编译器, g++ C++编译器。

 

 

 

#include <stdio.h>template <class T>T returnSelf(T &v){        return v;}int main(){        int i = 1;        float j = 2.0f;        double k = 3.0;        printf("i is :%d\n",returnSelf(i));        printf("j is :%f\n",returnSelf(j));        printf("k is :%f\n",returnSelf(k));}
以上程序的注意点:float和double的说明符都是%f
原创粉丝点击