midCat
midCat

Reputation: 123

use Boost python in Qt creator

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?

Upvotes: 1

Views: 1555

Answers (2)

user2322413
user2322413

Reputation:

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

apt-get install python2.7-dev

Upvotes: 1

dfranca
dfranca

Reputation: 5322

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

Upvotes: 3

Related Questions