PDA

View Full Version : error in Python script



HanyM.Magdy
15th August 2010, 15:21
I have write a program to run python script [python2.4] under CentOS with Qt4.7

class QPython
{
private:
QString strScript;
public:
QPython(){}
QPython(QString _strScript)
{strScript = _strScript;}
~QPython(){}
int PythonInitialize()
{
Py_Initialize();
return Py_IsInitialized();
}
int process_expression(char* cScript)
{
return PyRun_SimpleString(cScript);
}
void PythonFinalize()
{Py_Finalize();}
};
i have an error
mainwindow.o: In function `QPython::PythonInitialize()':
/root/Desktop/PythonInterpreter/QPython.h:20: undefined reference to `Py_Initialize'
/root/Desktop/PythonInterpreter/QPython.h:21: undefined reference to `Py_IsInitialized'
mainwindow.o: In function `QPython:: process_expression(char*)':
/root/Desktop/PythonInterpreter/QPython.h:25: undefined reference to `PyRun_SimpleString'
mainwindow.o: In function `QPython::PythonFinalize()':
/root/Desktop/PythonInterpreter/QPython.h:28: undefined reference to `Py_Finalize'
collect2: ld returned 1 exit status

i need to solve it, i search with google and i don't find the solution for it, i see the solution for DevC++.
Thanks Hany

alexisdm
16th August 2010, 00:49
If you compile with qmake, you should have a line like this in your .pro file

LIBS += -lpython2.4