1

I want to embedded python code in Qt C++ code. I create a console Qt app for test.

My .pro is

SOURCES += main.cpp
LIBS = -lboost_python -lpython27

HEADERS += /usr/include/python2.7

My main.cpp file is

#include <QCoreApplication>
#include <boost/python.hpp>

using namespace boost::python;

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    return a.exec();
}

But I found I can't build this program.

error message is:

/usr/include/boost/python/detail/wrap_python.hpp:50: 
Error:pyconfig.h: No such file or directory

I googled this problem, but havn't got answer.

How to configure Qt I want embedded Python code in My Qt C++ program?

2
  • Do you have the python developer package installed on your system? Generally, package maintainers only distribute pyconfig.h in the developer package. Commented Mar 9, 2013 at 4:23
  • I can find pyconfig.h in /usr/include/python2.7 I had install libpython2.7 in Ubuntu Commented Mar 9, 2013 at 4:50

2 Answers 2

3

it's INCLUDEPATH, not HEADERS in .pro file.

Sign up to request clarification or add additional context in comments.

Comments

1

You must install python developer package at first. In Ubuntu you can use apt-get as the following:

apt-get install python2.7-dev

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.