Embedding C into Python

John McKown joarmc at linux2.johnmckown.net
Sat Oct 23 16:41:36 EDT 1999


On Sat, 23 Oct 1999 16:42:45 -0600, Jeff Shipman - UC <jeff at nmt.edu> wrote:

>/tmp/ccype0NL.o: In function `blah_add':
>/tmp/ccype0NL.o(.text+0x24): undefined reference to `PyArg_ParseTuple'
>/tmp/ccype0NL.o(.text+0x4f): undefined reference to `Py_BuildValue'
>/tmp/ccype0NL.o: In function `initblah':
>/tmp/ccype0NL.o(.text+0x7b): undefined reference to `Py_InitModule4'
>collect2: ld returned 1 exit status

Sounds to me like you forgot to include the Python libraries in the gcc
command. 

gcc blahblah.c -L /usr/lib/python1.5/config -l python1.5

Note that the /usr/lib/python1.5/config may be different on your system.
Look for something like "libpython*.a"

Hope this helps get you going,
John




More information about the Python-list mailing list