Problem: embedding Python

mmf mf1987 at arcor.de
Sat May 21 07:30:51 EDT 2005


Hallo!

I tried to use Python from C like it is described in the Python
Docmentation. So I wrote the following C source file:

#include <Python.h>
int
main(int argc, char *argv[])
{
	Py_Initialize();
	PyRun_SimpleString("print 'Hallo World!'\n");
	Py_Finalize();
	return 0;
}

I saved it as run.c and tried to compile it using the following
command:
gcc  run.c

But that always results in a list of errors:

/tmp/cc1tmrPU.o(.text+0x1d): In function `main':
: undefined reference to `Py_Initialize'
/tmp/cc1tmrPU.o(.text+0x2a): In function `main':
: undefined reference to `PyRun_SimpleString'
/tmp/cc1tmrPU.o(.text+0x32): In function `main':
: undefined reference to `Py_Finalize'

What am I doing wrong? Can you help me?

Tanks.

Best regards,
Markus




More information about the Python-list mailing list