Embedded Python Woes

Ryan Phillips ryan.phillips at csus.edu
Wed Feb 6 19:19:13 EST 2002


You are not linking to the python library.  -lpython22 might be the correct
switch.  Winbloze user here :/

-ryan

"Salvador Peralta" <admin at salvador.venice.ca.us> wrote in message
news:a3se8h$bnm$1 at siamese.noc.ucla.edu...
> 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