Link problems embedding python in Linux. HELP!

jvanar1 at my-deja.com jvanar1 at my-deja.com
Fri Dec 8 12:26:48 EST 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[])
{
  Py_Initialize();
  printf("Done.\n");
  Py_Finalize();
  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 python.org
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...
-J


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list