By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,495 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

Embedding python with mingw compilers

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.