Wednesday, October 08, 2008

Touchy feely gcc

I am writing code in C after several years. Needless to say, I am woefully out of touch and don't remember the most basic of things. Add to that, I am writing code using a simple text editor and compiling it using gcc on commandline. Every time I see a funny error, it takes me a while to actually understand what is wrong. A really good IDE with awesome intellisense really does spoil you!

So I got this funny little compilation error which left me stumped:

/tmp/cckI2FzP.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status


I googled and found that this error is normally related to C++, but I was writing code in plain old C. So what was wrong? I found later that I had named my code file as List.C instead of List.c. After renaming it to List.c, all was well.

Turns out that filename extensions in linux are case sensitive (wonder why I did not run into that problem all these years),  and that C is a commonly used extension for C++