Advertisement

Oddball error compiling with GCC

Started by December 12, 2004 11:14 AM
4 comments, last by nmi 19 years, 9 months ago
Well, where have I been all this time? Don't ask, because I don't know myself. Anyway, here's my problem. I'm writing my first Linux program and it's just a simple test to communicate between Winsock and BSD sockets. At this point all I'm trying to do is get a socket open and connected between the two machines and I've managed to get both source files on my Windows and Linux machines to compile without errors. Now here's the catch. Visual C links the file just fine, but GCC returns this error:
Quote: /tmp/ccFqBqfb.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status
As far as I can tell, I have all the neccessary libraries to compile properly. Has someone else encountered this before? Does somebody know what I'm doing wrong?
WhoopA, the Official Kicker of Butts--- Where have I been all these years?
Did you use 'g++' to link your objects, or did you use 'ld' or 'gcc' ?
Advertisement
GCC. There's only one source file so the command I'm using to compile and link is "gcc sockets.cpp".
WhoopA, the Official Kicker of Butts--- Where have I been all these years?
As nmi was getting at, use g++ instead. It'll automagically handle the special linking C++ needs, to put it simply.
That did it! Thanks, I'll keep that in mind when I'm compiling from now on.
WhoopA, the Official Kicker of Butts--- Where have I been all these years?
If you call the compiler using g++, then all the needed libraries and some settings are automatically included. If you just call gcc, you have to set them by yourself or you get those errors described.

This topic is closed to new replies.

Advertisement