I have written a simple C program using gcc compiler in Ubuntu enviroment. The code is simple. Howver, when i try to compile, it is giving an error which I am not able to fathom. Here is the code and the error
# include <stdio.h>
int main() {
enum mar_status {
single,married,divorced
};
enum mar_status person1,person2;
person1 = single;
printf("%d\n",person1); //line B
}
I am getting the following error when I compile
gcc enum2.cc
/tmp/cc6stgaW.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status
If I remove the printf statement at line B, everything goes fine. Any ideas as to why the compilation is failing ?
You are using gcc to compile C++ code? (
.ccextension)Either rename the file to
enum2.cor compile withg++.