lundi 1 août 2016

undefined reference to `__gxx_personality_v0' with gcc [duplicate]

Possible Duplicate:
What is __gxx_personality_v0 for?

I've seen this question circulating around here in the context of compiling C++ code. However I am to compile a pure C code and keep on getting this error. I am forbidden to use "-lstdc++" as a workaround to this gcc problem. How to change my code to get it working and why is this error popping out?

My simplified code:

//this is main.cpp
#include <stdio.h>
int main()
{
    char ch[3];
    ch[0] = getc(stdin);
    ch[1] = getc(stdin);
    ch[2] = '�';
    printf("%sn", ch);
    return 0;
}

My compile command is:

gcc main.cpp

Aucun commentaire:

Enregistrer un commentaire