Embedding Python

Diez B. Roggisch deetsNOSPAM at web.de
Sat Mar 26 12:06:50 EST 2005


Markus Franz wrote:

> Diez B. Roggisch wrote:
> 
>>>/home/mmf/tmp/ccVD2V4h.o(.text+0x1d): In function `main':
>>>: undefined reference to `Py_Initialize'
>>>/home/mmf/tmp/ccVD2V4h.o(.text+0x2a): In function `main':
>>>: undefined reference to `PyRun_SimpleString'
>>>/home/mmf/tmp/ccVD2V4h.o(.text+0x32): In function `main':
>>>: undefined reference to `Py_Finalize'
>>>/home/mmf/tmp/ccVD2V4h.o(.eh_frame+0x11): undefined reference to
>>>`__gxx_personality_v0'
>>>collect2: ld returned 1 exit status
>>>
>>>What am I doing wrong?
>> 
>> Not linking against libpython.so?
> 
> I don't understand what you mean...

Well, you need to link against the python library to make known where the
respective symbols are from. That is also necessary for all other libs out
there - e.g. the linker switch -lm links against libm.so. For someone who
_codes_ in C/C++ that should be obvious - or so I thought. What
build-environment do you use?

The line

>>>/home/mmf/tmp/ccVD2V4h.o(.eh_frame+0x11): undefined reference to
>>>`__gxx_personality_v0'

suggest that you also miss linking against libstdc++ - an error that
sometimes happened to me too - no idea why, it _should_ be included
implicitely when linking C++ objects. No big deal though, just also add it
to the linking process.
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list