embedding python, missing symbols

Martin v. Löwis martin at v.loewis.de
Sat Jan 25 22:10:54 CET 2003


Jack Diederich <jack at performancedrivers.com> writes:

> > > gcc -I<path to Python.h> ./libpython2.2.a example.c
> > gcc -o example.o -I<path to Python.h> example.c
> > gcc example.o -o example -L<path to Python-libs> -lpython2.2
> The -L<path> -l<name> combination gets translated to the plainer
> full-path of the actual .a lib.  It's a lot more flexible for distributing
> makefiles, but equivalent to the above.

No, it's not. You are passing libpython2.2.a first; this is
incorrect. In the second invocation, -lpython2.2 is passed last.

> I get the same errors
> /tmp/cce2iMj2.o(.text+0x31): undefined reference to `Py_Initialize'
> /tmp/cce2iMj2.o(.text+0x41): undefined reference to `PyString_FromString'
> /tmp/cce2iMj2.o(.text+0x52): undefined reference to `PyImport_Import'
> <snip>
> /tmp/cce2iMj2.o(.text+0x295): undefined reference to `Py_Finalize'

I can't really believe that. Are you sure you are invoking the
compiler precisely as suggested?

Regards,
Martin





More information about the Python-list mailing list