Problem embedding Python...

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

    #1

    Problem embedding Python...

    Hi Folks,

    I have now managed to work out how to embed Python to allow me to
    script my application, the only problem is I am getting a compiler
    error when I try to compile:

    The error is:

    Compiler: Default compiler
    Executing g++.exe...
    g++.exe "C:\Documen ts and
    Settings\andy.m ccall\Desktop\P ythonEmbed\main .cpp" -o "C:\Documen ts and
    Settings\andy.m ccall\Desktop\P ythonEmbed\main .exe"
    -I"C:\Dev-Cpp\lib\gcc\min gw32\3.4.2\incl ude"
    -I"C:\Dev-Cpp\include\c++ \3.4.2\backward "
    -I"C:\Dev-Cpp\include\c++ \3.4.2\mingw32"
    -I"C:\Dev-Cpp\include\c++ \3.4.2" -I"C:\Dev-Cpp\include"
    -I"C:\Python24\i nclude" -L"C:\Dev-Cpp\lib" -L"C:\Python24\L ib"
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x2b):main.cp p:
    undefined reference to `_imp__Py_Initi alize'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x3e):main.cp p:
    undefined reference to `_imp__PyString _FromString'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x4e):main.cp p:
    undefined reference to `_imp__PyImport _Import'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x68):main.cp p:
    undefined reference to `_imp__PyModule _GetDict'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x80):main.cp p:
    undefined reference to `_imp__PyDict_G etItemString'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x96):main.cp p:
    undefined reference to `_imp__PyCallab le_Check'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0xb7):main.cp p:
    undefined reference to `_imp__PyObject _CallFunction'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0xcd):main.cp p:
    undefined reference to `_imp__PyInt_As Long'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x146):main.c pp:
    undefined reference to `_imp__Py_Final ize'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x17c):main.c pp:
    undefined reference to `_imp__PyArg_Pa rseTuple'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x1a6):main.c pp:
    undefined reference to `_imp__Py_Build Value'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x1c2):main.c pp:
    undefined reference to `_imp__PyImport _AddModule'
    C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x1f0):main.c pp:
    undefined reference to `_imp__Py_InitM odule4'
    collect2: ld returned 1 exit status

    Execution terminated

    Can anyone help me please?

    Thanks,

    Andrew.

  • Dave Mandelin

    #2
    Re: Problem embedding Python...

    > C:\DOCUME~1\AND Y~1.MCC\LOCALS~ 1\Temp/cckhbaaa.o(.tex t+0x2b):main.cp p:[color=blue]
    > undefined reference to `_imp__Py_Initi alize'[/color]

    These errors indicate that the linker can't find the Python library
    (python24.lib).
    [color=blue]
    > -L"C:\Python24\L ib"[/color]

    I think you want to say -L"C:\Python24\L ibs" instead. 'libs' contains
    the binary lib files, while 'lib' contains the .py library files.

    --
    Want to play tabletop RPGs online?
    Check out RPZen: http://koboldsoft.com

    Comment

    Working...