Embeding python with mingw on win32 and python 2.4.4

M

mani

Hi
I'm bringing up an old story once more! I'm on win32 (winxp sp2)
python 2.4.4. mingw gcc version is 3.4.5. msys is in c:\msys. mingw is
in c:\mingw and python is in c:\pyton24. there are also python24.lib
and libpython24.a in c:\python24\libs.
when I try to compile this sample code [1] from msys prompt with
command [2] in
msys shell I get the results [3].
this subject was discussed a few times over these years and I tried
everything in the posts and forums that I found and google could
translate with no success. I realy need your suggestion!

Regards, Mani

[1] Sample code:

#include<Python.h>

int main(int argc, char *argv[])
{
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
Py_Finalize();
return 0;

}

[2] Command:
$ g++ -I/c/python24/include -I/c/MinGW/include -L/c/python24/libs -L/
c/
mingw/lib -lpython24 -shared -mwin32 -o p1 p1.o

[3] Results:
p1.o:p1.cpp:(.text+0x2b): undefined reference to `_imp__Py_Initialize'
p1.o:p1.cpp:(.text+0x39): undefined reference to
`_imp__PyRun_SimpleString'
p1.o:p1.cpp:(.text+0x40): undefined reference to `_imp__Py_Finalize'
collect2: ld returned 1 exit status
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,961
Messages
2,570,131
Members
46,689
Latest member
liammiller

Latest Threads

Top