I get the following error when I try to use qt5 for compiling - qt4 works fine. I always make sure to do make clean before make
g++ -Wl,-O1 -o raport main.o mainwindow.o qcgaugewidget.o qcustomplot.o qrc_res_file.o moc_mainwindow.o moc_qcgaugewidget.o moc_qcustomplot.o -lQt5OpenGL -L/usr/lib64 -lQt5PrintSupport -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Sql -lQt5Xml -lQt5Core -lGL -lpthread
moc_mainwindow.
o:(.
data.
rel.
ro._ZTV10MainWindow
[_ZTV10MainWindow
]+0x188
): undefined reference to `
QWidget::styleChange(QStyle
&)'moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x190): undefined reference to `QWidget::enabledChange(bool)'
moc_mainwindow.
o:(.
data.
rel.
ro._ZTV10MainWindow
[_ZTV10MainWindow
]+0x198
): undefined reference to `
QWidget::paletteChange(QPalette const
&)'moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x1a0): undefined reference to `QWidget::fontChange(QFont const&)'
moc_mainwindow.
o:(.
data.
rel.
ro._ZTV10MainWindow
[_ZTV10MainWindow
]+0x1a8
): undefined reference to `
QWidget::windowActivationChange(bool)'moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x1b0): undefined reference to `QWidget::languageChange()'
moc_mainwindow.
o:(.
data.
rel.
ro._ZTV11ProgressBar
[_ZTV11ProgressBar
]+0x188
): undefined reference to `
QWidget::styleChange(QStyle
&)'moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x190): undefined reference to `QWidget::enabledChange(bool)'
moc_mainwindow.
o:(.
data.
rel.
ro._ZTV11ProgressBar
[_ZTV11ProgressBar
]+0x198
): undefined reference to `
QWidget::paletteChange(QPalette const
&)'moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x1a0): undefined reference to `QWidget::fontChange(QFont const&)'
moc_mainwindow.
o:(.
data.
rel.
ro._ZTV11ProgressBar
[_ZTV11ProgressBar
]+0x1a8
): undefined reference to `
QWidget::windowActivationChange(bool)'moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x1b0): undefined reference to `QWidget::languageChange()'
g++ -Wl,-O1 -o raport main.o mainwindow.o qcgaugewidget.o qcustomplot.o qrc_res_file.o moc_mainwindow.o moc_qcgaugewidget.o moc_qcustomplot.o -lQt5OpenGL -L/usr/lib64 -lQt5PrintSupport -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Sql -lQt5Xml -lQt5Core -lGL -lpthread
moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x188): undefined reference to `QWidget::styleChange(QStyle&)'
moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x190): undefined reference to `QWidget::enabledChange(bool)'
moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x198): undefined reference to `QWidget::paletteChange(QPalette const&)'
moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x1a0): undefined reference to `QWidget::fontChange(QFont const&)'
moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x1a8): undefined reference to `QWidget::windowActivationChange(bool)'
moc_mainwindow.o:(.data.rel.ro._ZTV10MainWindow[_ZTV10MainWindow]+0x1b0): undefined reference to `QWidget::languageChange()'
moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x188): undefined reference to `QWidget::styleChange(QStyle&)'
moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x190): undefined reference to `QWidget::enabledChange(bool)'
moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x198): undefined reference to `QWidget::paletteChange(QPalette const&)'
moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x1a0): undefined reference to `QWidget::fontChange(QFont const&)'
moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x1a8): undefined reference to `QWidget::windowActivationChange(bool)'
moc_mainwindow.o:(.data.rel.ro._ZTV11ProgressBar[_ZTV11ProgressBar]+0x1b0): undefined reference to `QWidget::languageChange()'
To copy to clipboard, switch view to plain text mode
I have checked what other threads suggested
my .pro looks like this
# -------------------------------------------------
# Project created by QtCreator 2009-12-02T13:24:40
# -------------------------------------------------
QT += network \
opengl \
sql \
xml \
gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
TARGET = raport
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp \
qcgaugewidget.cpp \
qcustomplot.cpp
HEADERS += mainwindow.h \
qcgaugewidget.h \
qcustomplot.h
FORMS += mainwindow.ui
CONFIG += static
RESOURCES += \
res_file.qrc
# -------------------------------------------------
# Project created by QtCreator 2009-12-02T13:24:40
# -------------------------------------------------
QT += network \
opengl \
sql \
xml \
gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
TARGET = raport
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp \
qcgaugewidget.cpp \
qcustomplot.cpp
HEADERS += mainwindow.h \
qcgaugewidget.h \
qcustomplot.h
FORMS += mainwindow.ui
CONFIG += static
RESOURCES += \
res_file.qrc
To copy to clipboard, switch view to plain text mode
and all header files mentioned in .pro contain
#include <QWidget>
Bookmarks