Embeding python with mingw on win32 and python 2.4.4

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mani

    Embeding python with mingw on win32 and python 2.4.4

    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 is also python24.lib
    and libpython24.a in c:\python24\lib s.
    when I try to compile this sample code [1] from 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_SimpleStr ing("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:(.t ext+0x2b): undefined reference to `_imp__Py_Initi alize'
    p1.o:p1.cpp:(.t ext+0x39): undefined reference to
    `_imp__PyRun_Si mpleString'
    p1.o:p1.cpp:(.t ext+0x40): undefined reference to `_imp__Py_Final ize'
    collect2: ld returned 1 exit status
Working...