Results 1 to 2 of 2

Thread: error in Python script

  1. #1
    Join Date
    Jul 2010
    Location
    Cairo - Egypt
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default error in Python script

    I have write a program to run python script [python2.4] under CentOS with Qt4.7
    Qt Code:
    1. class QPython
    2. {
    3. private:
    4. QString strScript;
    5. public:
    6. QPython(){}
    7. QPython(QString _strScript)
    8. {strScript = _strScript;}
    9. ~QPython(){}
    10. int PythonInitialize()
    11. {
    12. Py_Initialize();
    13. return Py_IsInitialized();
    14. }
    15. int process_expression(char* cScript)
    16. {
    17. return PyRun_SimpleString(cScript);
    18. }
    19. void PythonFinalize()
    20. {Py_Finalize();}
    21. };
    To copy to clipboard, switch view to plain text mode 
    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

  2. #2
    Join Date
    May 2010
    Posts
    24
    Thanked 8 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: error in Python script

    If you compile with qmake, you should have a line like this in your .pro file
    Qt Code:
    1. LIBS += -lpython2.4
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Embedding PyQt4 into an Application running Python via Boost::Python
    By GreyHound in forum Installation and Deployment
    Replies: 1
    Last Post: 6th February 2012, 06:48
  2. System Error in Python embeded script
    By HanyM.Magdy in forum Qt Programming
    Replies: 0
    Last Post: 9th August 2010, 12:20
  3. Python Script in Qt C++
    By HanyM.Magdy in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2010, 16:47
  4. Can I include a script from script?
    By yycking in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2009, 03:01
  5. Replies: 7
    Last Post: 15th April 2007, 01:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.