Embedded Python Woes

Salvador Peralta admin at salvador.venice.ca.us
Wed Feb 6 19:32:35 EST 2002


Hi,

I'm trying to compile the following hello sir robin with gcc without 
much success.  Can someone please tell me where am I going wrong?  

#include<Python.h>
#include<pythonrun.h>

int main() {

Py_Initialize();
PyRun_SimpleString("x = brave + sir + robin");

}


$ gcc pytest.c -I/usr/include/python2.1/ 

/home/foo/tmp/ccpO93io.o: In function `main':
/home/foo/tmp/ccpO93io.o(.text+0x7): undefined reference to 
`Py_Initialize'/home/foo/tmp/ccpO93io.o(.text+0x14): undefined 
reference to `PyRun_SimpleString'
collect2: ld returned 1 exit status

$ pwd
/usr/include/python2.1
$ grep "PyRun_SimpleString\|Py_Initialize" *
pythonrun.h:DL_IMPORT(void) Py_Initialize(void);
pythonrun.h:DL_IMPORT(int) PyRun_SimpleString(char *);



More information about the Python-list mailing list