PDA

View Full Version : GCC libraries or something...


Lster
June 29th, 2006, 09:49 AM
I can get gcc up, but can't compile. I get the following error:

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

Please help - I'm desperate!

-Rick-
June 29th, 2006, 10:26 AM
Use g++ instead of gcc for cpp files.

thumper
June 29th, 2006, 10:34 AM
did you install gcc or build-essential?

Lster
June 29th, 2006, 11:16 AM
g++ will compile c++. How come gcc doesn't work?

I would still like to use c as well as c++, can i get gcc to work?

I have installed gcc and build-essentials.

thumper
June 29th, 2006, 11:56 AM
You need to give us the full output of the command including the command line you are using to compile.

Lster
June 29th, 2006, 12:08 PM
I use "gcc whateverDirectory/program.c++", the full error is

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

nothing else happens.

asimon
June 29th, 2006, 01:56 PM
If you want this program compiled as C, rename it to whateverDirectory/program.c . Then your gcc command will work.

You can compile c++ programs with gcc too (it detects them through the file extension), but gcc can not link c++ programs, i.e. you can use 'gcc -c hello.cpp' to compile a c++ program into an object file but gcc can't link that object file, you need g++ for this. Thus best use g++ consistently for c++ programs and gcc for C programs.

EDIT: see An Introduction to GCC: 7.1 Compiling a simple C++ program (http://www.network-theory.co.uk/docs/gccintro/gccintro_54.html).