469,275 Members | 1,871 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

Embedding python with mingw compilers

I'm successfully created python extensions on windows using the mingw
compiler (with swig), now I'm trying to embed python in a c-program.

The simple example (included below) is from the manual. I compile it
with gcc 3.2.3:
gcc -o pytest -Ic:/python23/include -Lc:/python23/libs -lpython23 pytest.c

I then get error messages for the python calls, eg

undefined reference to `_imp__Py_Initialize'

I notice however that the .def file I used to create libpython23.a
does have references to _imp__Py_Initialize (as well as Py_Initialize)
and these also seem to be in the generated library file.

Any suggestions as to what else needs to be done to sort this out?


#include <Python.h>
main(int argc, char *argv[])
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
return 0;

Rule 1.
Jul 18 '05 #1
0 1060

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.