QT: make zickt rum
-
Ich erhalte eine kryptische Fehlermeldung beim Kompilieren einer QT-Anwendung.
#include <QtWidgets/QApplication> #include <QtWidgets/QLabel> #include <iostream> using namespace std; class MeinLabel : public QLabel { public: MeinLabel(const char* text) : QLabel(text) { } ~MeinLabel() { cout << "Destruktoraufruf\n"; } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); MeinLabel* mlabel = new MeinLabel("Erstes Qt-Programm"); mlabel->show(); int ergebnis = app.exec(); delete mlabel; return ergebnis; }
Ausgeführte Befehle:
qmake -project (funktioniert)
qmake (funktioniert)
make (liefert folgende Fehlermeldung)make -f Makefile.Release make[1]: Entering directory 'D:/Henry Weinert/Lernen/QT/test' g++ -c -fno-keep-inline-dllexport -pipe -O2 -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I. -I../../../../Qt/5.9.1/mingw53_32/include -I../../../../Qt/5.9.1/mingw53_32/include/QtGui -I../../../../Qt/5.9.1/mingw53_32/include/QtANGLE -I../../../../Qt/5.9.1/mingw53_32/include/QtCore -Irelease -I../../../../Qt/5.9.1/mingw53_32/mkspecs/win32-g++ -o release/main.o main.cpp g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release/test.exe release/main.o -lmingw32 -LD:/Qt/5.9.1/mingw53_32/lib D:/Qt/5.9.1/mingw53_32/lib/libqtmain.a -LC:/utils/my_sql/my_sql/lib -LC:/utils/postgresql/pgsql/lib -lshell32 D:/Qt/5.9.1 /mingw53_32/lib/libQt5Core.a D:/Qt/5.9.1/mingw53_32/lib/libQt5Gui.a D:/Qt/5.9.1/mingw53_32/lib/libQt5Core.a release/main.o:main.cpp:(.text+0x60): undefined reference to `_imp___ZN12QApplicationC1ERiPPci' release/main.o:main.cpp:(.text+0xbe): undefined reference to `_imp___ZN6QLabelC2ERK7QStringP7QWidget6QFlagsIN2Qt10WindowTypeEE' release/main.o:main.cpp:(.text+0xfc): undefined reference to `_imp___ZN7QWidget4showEv' release/main.o:main.cpp:(.text+0x109): undefined reference to `_imp___ZN12QApplication4execEv' release/main.o:main.cpp:(.text+0x158): undefined reference to `_imp___ZN6QLabelD2Ev' release/main.o:main.cpp:(.text+0x16c): undefined reference to `_imp___ZN12QApplicationD1Ev' release/main.o:main.cpp:(.text+0x1ee): undefined reference to `_imp___ZN12QApplicationD1Ev' release/main.o:main.cpp:(.text$_ZN9MeinLabelD1Ev[__ZN9MeinLabelD1Ev]+0x58): undefined reference to `_imp___ZN6QLabelD2Ev' release/main.o:main.cpp:(.text$_ZN9MeinLabelD0Ev[__ZN9MeinLabelD0Ev]+0x58): undefined reference to `_imp___ZN6QLabelD2Ev' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x8): undefined reference to `QLabel::metaObject() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xc): undefined reference to `QLabel::qt_metacast(char const*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x10): undefined reference to `QLabel::qt_metacall(QMetaObject::Call, int, void**)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x1c): undefined reference to `QLabel::event(QEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x38): undefined reference to `QWidget::devType() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x3c): undefined reference to `QWidget::setVisible(bool)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x40): undefined reference to `QLabel::sizeHint() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x44): undefined reference to `QLabel::minimumSizeHint() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x48): undefined reference to `QLabel::heightForWidth(int) const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x4c): undefined reference to `QWidget::hasHeightForWidth() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x50): undefined reference to `QWidget::paintEngine() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x54): undefined reference to `QLabel::mousePressEvent(QMouseEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x58): undefined reference to `QLabel::mouseReleaseEvent(QMouseEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x5c): undefined reference to `QWidget::mouseDoubleClickEvent(QMouseEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x60): undefined reference to `QLabel::mouseMoveEvent(QMouseEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x64): undefined reference to `QWidget::wheelEvent(QWheelEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x68): undefined reference to `QLabel::keyPressEvent(QKeyEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x6c): undefined reference to `QWidget::keyReleaseEvent(QKeyEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x70): undefined reference to `QLabel::focusInEvent(QFocusEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x74): undefined reference to `QLabel::focusOutEvent(QFocusEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x78): undefined reference to `QWidget::enterEvent(QEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x7c): undefined reference to `QWidget::leaveEvent(QEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x80): undefined reference to `QLabel::paintEvent(QPaintEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x84): undefined reference to `QWidget::moveEvent(QMoveEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x88): undefined reference to `QWidget::resizeEvent(QResizeEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x8c): undefined reference to `QWidget::closeEvent(QCloseEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x90): undefined reference to `QLabel::contextMenuEvent(QContextMenuEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x94): undefined reference to `QWidget::tabletEvent(QTabletEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x98): undefined reference to `QWidget::actionEvent(QActionEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0x9c): undefined reference to `QWidget::dragEnterEvent(QDragEnterEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xa0): undefined reference to `QWidget::dragMoveEvent(QDragMoveEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xa4): undefined reference to `QWidget::dragLeaveEvent(QDragLeaveEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xa8): undefined reference to `QWidget::dropEvent(QDropEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xac): undefined reference to `QWidget::showEvent(QShowEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xb0): undefined reference to `QWidget::hideEvent(QHideEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xb4): undefined reference to `QWidget::nativeEvent(QByteArray const&, void*, long*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xb8): undefined reference to `QLabel::changeEvent(QEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xbc): undefined reference to `QWidget::metric(QPaintDevice::PaintDeviceMetric) const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xc0): undefined reference to `QWidget::initPainter(QPainter*) const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xc4): undefined reference to `QWidget::redirected(QPoint*) const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xc8): undefined reference to `QWidget::sharedPainter() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xcc): undefined reference to `QWidget::inputMethodEvent(QInputMethodEvent*)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xd0): undefined reference to `QWidget::inputMethodQuery(Qt::InputMethodQuery) const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xd4): undefined reference to `QLabel::focusNextPrevChild(bool)' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xe8): undefined reference to `non-virtual thunk to QWidget::devType() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xec): undefined reference to `non-virtual thunk to QWidget::paintEngine() const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xf0): undefined reference to `non-virtual thunk to QWidget::metric(QPaintDevice::PaintDeviceMetric) const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xf4): undefined reference to `non-virtual thunk to QWidget::initPainter(QPainter*) const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xf8): undefined reference to `non-virtual thunk to QWidget::redirected(QPoint*) const' release/main.o:main.cpp:(.rdata$_ZTV9MeinLabel[__ZTV9MeinLabel]+0xfc): undefined reference to `non-virtual thunk to QWidget::sharedPainter() const' collect2.exe: error: ld returned 1 exit status Makefile.Release:63: recipe for target 'release/test.exe' failed make[1]: *** [release/test.exe] Error 1 make[1]: Leaving directory 'D:/Henry Weinert/Lernen/QT/test' Makefile:36: recipe for target 'release' failed make: *** [release] Error 2
Wo ist der Fehler?
-
Sieht auf den ersten Blick so aus, als ob du dem Linker nicht sagst in welcher Bibliothek sich die Funktionen befinden.
-
Und wie schaut das erzeugte *.pro File aus?
-
###################################################################### # Automatically generated by qmake (3.1) Wed Jul 5 09:23:21 2017 ###################################################################### TEMPLATE = app TARGET = test INCLUDEPATH += . # The following define makes your compiler warn you if you use any # feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 # Input SOURCES += main.cpp
-
Dieser Thread wurde von Moderator/in rapso aus dem Forum Spiele-/Grafikprogrammierung in das Forum Andere GUIs - Qt, GTK+, wxWidgets verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
QT += widgets
-
Danke, er kompiliert jetzt und liefert auch eine ausführbare Datei. Allerdings erhalte ich, wenn ich da Programm starten will, weitere Fehlermeldungen (Windows 7)
Ohne Administratorrechte:
Das Programm kann nicht gestartet werden, da libgcc_s_sjlj-1.dll auf dem Computer fehlt. Installieren Sie das Programm erneut, um das Problem zu beheben.
Mit:
--------------------------- test.exe - Einsprungpunkt nicht gefunden --------------------------- Der Prozedureinsprungpunkt "__gxx_personality_sj0" wurde in der DLL "libstdc++-6.dll" nicht gefunden.
-
s. meine Links unter [gelöst] Debug geht, Release .exe nicht