Link problems embedding python in Linux. HELP!

jvanar1 at jvanar1 at
Fri Dec 8 18:26:48 CET 2000

Hello all,

I am having serious link errors trying to embed python within a C
prog.  I cant even gete something as simple as this to run:

#include <stdio.h>
#include <python1.5/Python.h>

int main(int argc, char *argv[])
  return 1;

I've tryed this on gcc 2.96 AND 2.95 AND 2.92 with any luck.  Here is
the error I get:

/tmp/ccC8gDMG.o: In function `main':
/tmp/ccC8gDMG.o(.text+0x7): undefined reference to `Py_Initialize'
/tmp/ccC8gDMG.o(.text+0x1c): undefined reference to `Py_Finalize'
collect2: ld returned 1 exit status

I've read every resource available, but nothing tells me what to link
with. here is my compilation line:

gcc -o go -lpython1.5 -L/usr/lib/python1.5 go.c

I am beating my head against the wall.. Oh yeah, per the
pages I've tried obtaining the link option with ">>>import
distutils.sysconfig" but it doesn't exist!  I need serious help here!

I've tryed this on Linux 6.2, 6.1 and 7.0 to no avail.

Thanks for any and all help...

Sent via
Before you buy.

More information about the Python-list mailing list