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 to `vtable 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 to `vtable 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 to `vtable 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 to `vtable 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 to `vtable 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 to `vtable 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 to `vtable 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 += core
QT -= gui
TARGET = PythonQtTest
CONFIG += console
CONFIG -= app_bundle
INCLUDEPATH += /usr/include/python2.7
INCLUDEPATH += /usr/include/PythonQt
TEMPLATE = 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.
↧