Giving your C/C++ Application a Python Command Line...
Hi Folks, I am building an application under multiple OS's, and I wanted to give my application For example, the test application I am working on is a calculator and I would like to have a menu in the GUI option to open a command line where you can use Python commands to perfom the functions of the application within the Python command line. For example, if I wanted to clear the display or display the about screen I would be able type the command in the Python coimmand line. To do this I think I need to embed Python in my application, and then expose my C/C++ functions to Python. I have read the documents on embedding Python and I can give my application a command line, but I am having issues exposing my C/C++ functions to Python. Does anyone know of any tutorials or example code that show how to do this? Thanks, Andrew McCall -- http://mail.python.org/mailman/listinfo/python-list
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:\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. -- http://mail.python.org/mailman/listinfo/python-list