Setting up PythonQt in Qt Creator on Arch Linux
-
Hello everyone,
I'm struggeling setting up the PythonQt library in Qt Creator.
So far, I installed pythonqt from the AUR and added the library to my .pro file, but the build fails with the following error:@[...]
g++ -Wl,-O1,--sort-common,--as-needed,-z,relro -o PythonQtTest main.o -lPythonQt -lQt5Core -lpthread
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference tovtable for PythonQtWrapper_QWizard' Makefile:182: recipe for target 'PythonQtTest' failed /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference to
vtable for PythonQtWrapper_QWizardPage'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference tovtable for PythonQtWrapper_QWheelEvent' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference to
vtable for PythonQtWrapper_QWidgetAction'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference tovtable for PythonQtWrapper_QWhatsThis' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference to
vtable for PythonQtWrapper_QVector4D'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference tovtable for PythonQtWrapper_QWidget' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference to
vtable for PythonQtWrapper_QWindowsStyle'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference tovtable for PythonQtWrapper_QVector2D' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference to
vtable for PythonQtWrapper_QWorkspace'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference tovtable for PythonQtWrapper_QVector3D' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference to
vtable for PythonQtWrapper_QValidator'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference tovtable for PythonQtWrapper_QWhatsThisClickedEvent' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference to
vtable for PythonQtWrapper_QWidgetItem'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libPythonQt.so: undefined reference to `vtable for PythonQtWrapper_QWindowStateChangeEvent'
[...]@This is my .pro file:
@
QT += coreQT -= gui
TARGET = PythonQtTest
CONFIG += console
CONFIG -= app_bundleINCLUDEPATH += /usr/include/python2.7
INCLUDEPATH += /usr/include/PythonQtTEMPLATE = app
SOURCES += main.cpp
HEADERS += PythonQt/PythonQt.h
unix|win32: LIBS += -lPythonQt
@And my main.cpp
@
#include <QCoreApplication>
#include <PythonQt.h>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);PythonQt::init(); PythonQtObjectPtr pythonContext = PythonQt::self()->getMainModule(); pythonContext.evalScript("print 'Hello Python!';"); return a.exec();
}
@Am I missing a certain include or library file? I already searched a lot on the Internet but I could not find a similar example.
-
-
Ok it turned out that I tried to use a Qt 4.8 version of PythonQt with Qt 5.2.
It also seems that unfortunately there aren't any builds for Qt 5 yet. Meh. -
Thanks for the tip, but PyQt rather looks like a binding you would use to write your whole application in Python. I am going to write my application in C++ and wanted to make it Scriptable using PythonQt.
Anyway, I'm looking at the Qt Script module again and I think I'll stick to this as it seems to provide the featues that I need.