embedding python, missing symbols

Jack Diederich jack at performancedrivers.com
Sat Jan 25 21:44:45 CET 2003


On Sat, Jan 25, 2003 at 12:08:41PM +0100, Two Inches wrote:
> Jack Diederich wrote:
> > I can't seem to make gcc happy
> > 
> > using the example main() from the embedding docs and doing
> > 
> > gcc -I<path to Python.h> ./libpython2.2.a example.c
> 
> Use -L to tell gcc where to search for libs and -l to tell it which libs 
> to link against.
> 
> something like this should work (not tested; I do prefer to separate 
> compiling and links as a matter of taste):
> 
> 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.

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'

-jackdied





More information about the Python-list mailing list