Problem embedding Python...

A

Andrew McCall

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:\Documents and
Settings\andy.mccall\Desktop\PythonEmbed\main.cpp" -o "C:\Documents and
Settings\andy.mccall\Desktop\PythonEmbed\main.exe"
-I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include"
-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\include" -L"C:\Dev-Cpp\lib" -L"C:\Python24\Lib"
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x2b):main.cpp:
undefined reference to `_imp__Py_Initialize'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x3e):main.cpp:
undefined reference to `_imp__PyString_FromString'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x4e):main.cpp:
undefined reference to `_imp__PyImport_Import'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x68):main.cpp:
undefined reference to `_imp__PyModule_GetDict'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x80):main.cpp:
undefined reference to `_imp__PyDict_GetItemString'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x96):main.cpp:
undefined reference to `_imp__PyCallable_Check'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0xb7):main.cpp:
undefined reference to `_imp__PyObject_CallFunction'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0xcd):main.cpp:
undefined reference to `_imp__PyInt_AsLong'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x146):main.cpp:
undefined reference to `_imp__Py_Finalize'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x17c):main.cpp:
undefined reference to `_imp__PyArg_ParseTuple'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x1a6):main.cpp:
undefined reference to `_imp__Py_BuildValue'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x1c2):main.cpp:
undefined reference to `_imp__PyImport_AddModule'
C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x1f0):main.cpp:
undefined reference to `_imp__Py_InitModule4'
collect2: ld returned 1 exit status

Execution terminated

Can anyone help me please?

Thanks,

Andrew.
 
D

Dave Mandelin

C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x2b):main.cpp:
undefined reference to `_imp__Py_Initialize'

These errors indicate that the linker can't find the Python library
(python24.lib).
-L"C:\Python24\Lib"

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

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top