Warum lässt sich mein Programm nicht unter Windows mit MinGW linken?

Alles rund um die Programmierung mit Qt
Antworten
GoaSkin
Beiträge: 102
Registriert: 13. Juni 2007 00:14
Wohnort: Darmstadt

Warum lässt sich mein Programm nicht unter Windows mit MinGW linken?

Beitrag von GoaSkin » 28. April 2020 21:51

Hallo,

ich entwickle eine Software zur Konfiguration eines MIDI-Keyboards mit HID-Schnittstelle. Da die Span-Slider und String-Spinboxen aus dem QXT-Projekt eine nützliche Sache beim User-Interface sind, aber das QXT-Projekt als Solches nicht mehr weiterentwickelt wird, habe ich die entsprechenden Komponenten in mein eigenes Projekt mit eingebunden.

Während sich das Projekt unter Linux und macOS anstandslos bauen lässt, scheitert das Linken unter Windows mit den folgenden Fehlermeldungen, die mich ratlos machen:


Code: Alles auswählen

g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\qkontrol.exe @object_script.qkontrol.Release  -LC:\Users\GoaSkin\Desktop\libusb-1.0.23\MinGW64\static C:\Users\GoaSkin\Desktop\libusb-1.0.23\MinGW64\static\libusb-1.0.a -LC:\Users\GoaSkin\Desktop\hidapi-hidapi-0.8.0-rc1\windows\debug -lhidapi C:\Qt\5.12.8\mingw73_64\lib\libQt5Widgets.a C:\Qt\5.12.8\mingw73_64\lib\libQt5Gui.a C:\Qt\5.12.8\mingw73_64\lib\libQt5Network.a C:\Qt\5.12.8\mingw73_64\lib\libQt5Test.a C:\Qt\5.12.8\mingw73_64\lib\libQt5Xml.a C:\Qt\5.12.8\mingw73_64\lib\libQt5Core.a release\qkontrol_resource_res.o
release/qkontrol.o:qkontrol.cpp:(.text+0x593b): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/qkontrol.o:qkontrol.cpp:(.text+0x8129): undefined reference to `__imp__ZNK13QxtSpanSlider10lowerValueEv'
release/qkontrol.o:qkontrol.cpp:(.text+0x81bd): undefined reference to `__imp__ZNK13QxtSpanSlider10upperValueEv'
release/qkontrol.o:qkontrol.cpp:(.text+0xb433): undefined reference to `__imp__ZNK13QxtSpanSlider10lowerValueEv'
release/qkontrol.o:qkontrol.cpp:(.text+0xb517): undefined reference to `__imp__ZNK13QxtSpanSlider10upperValueEv'
release/qkontrol.o:qkontrol.cpp:(.text+0x162fd): undefined reference to `__imp__ZN16QxtStringSpinBox16staticMetaObjectE'
release/qkontrol.o:qkontrol.cpp:(.text+0x1701e): undefined reference to `__imp__ZN16QxtStringSpinBox10setStringsERK11QStringList'
release/qkontrol.o:qkontrol.cpp:(.text+0x18ebe): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/qkontrol.o:qkontrol.cpp:(.text+0x1a9f9): undefined reference to `__imp__ZNK13QxtSpanSlider10upperValueEv'
release/qkontrol.o:qkontrol.cpp:(.text+0x1aaab): undefined reference to `__imp__ZNK13QxtSpanSlider10lowerValueEv'
release/qkontrol.o:qkontrol.cpp:(.text+0x1d70a): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/qkontrol.o:qkontrol.cpp:(.text+0x1ec73): undefined reference to `__imp__ZN13QxtSpanSlider7setSpanEii'
release/qkontrol.o:qkontrol.cpp:(.text$_ZN13Ui_mainwindow7setupUiEP11QMainWindow[_ZN13Ui_mainwindow7setupUiEP11QMainWindow]+0x547f): undefined reference to `__imp__ZN16QxtStringSpinBoxC1EP7QWidget'
release/qkontrol.o:qkontrol.cpp:(.text$_ZN13Ui_mainwindow7setupUiEP11QMainWindow[_ZN13Ui_mainwindow7setupUiEP11QMainWindow]+0x294c7): undefined reference to `__imp__ZN13QxtSpanSliderC1EP7QWidget'
release/qxtstringspinbox.o:qxtstringspinbox.cpp:(.text+0x152): undefined reference to `__imp__ZTV16QxtStringSpinBox'
release/qxtstringspinbox.o:qxtstringspinbox.cpp:(.text+0x1d8): undefined reference to `__imp__ZTV16QxtStringSpinBox'
release/qxtspanslider.o:qxtspanslider.cpp:(.text+0xa24): undefined reference to `__imp__ZTV13QxtSpanSlider'
release/qxtspanslider.o:qxtspanslider.cpp:(.text+0xb34): undefined reference to `__imp__ZTV13QxtSpanSlider'
release/qxtspanslider.o:qxtspanslider.cpp:(.text+0xc38): undefined reference to `__imp__ZTV13QxtSpanSlider'
release/qxtspanslider.o:qxtspanslider.cpp:(.text+0xdf4): undefined reference to `__imp__ZN13QxtSpanSlider17lowerValueChangedEi'
release/qxtspanslider.o:qxtspanslider.cpp:(.text+0xe17): undefined reference to `__imp__ZN13QxtSpanSlider17upperValueChangedEi'
release/qxtspanslider.o:qxtspanslider.cpp:(.text+0xe30): undefined reference to `__imp__ZN13QxtSpanSlider11spanChangedEii'
release/qxtspanslider.o:qxtspanslider.cpp:(.text+0xfa7): undefined reference to `__imp__ZN13QxtSpanSlider20upperPositionChangedEi'
release/qxtspanslider.o:qxtspanslider.cpp:(.text+0x1427): undefined reference to `__imp__ZN13QxtSpanSlider20lowerPositionChangedEi'
release/moc_qxtstringspinbox.o:moc_qxtstringspinbox.cpp:(.text+0x2a): undefined reference to `__imp__ZN16QxtStringSpinBox10setStringsERK11QStringList'
release/moc_qxtstringspinbox.o:moc_qxtstringspinbox.cpp:(.text+0x3a): undefined reference to `__imp__ZNK16QxtStringSpinBox7stringsEv'
release/moc_qxtstringspinbox.o:moc_qxtstringspinbox.cpp:(.text+0x1c5): undefined reference to `__imp__ZN16QxtStringSpinBox16staticMetaObjectE'
release/moc_qxtstringspinbox.o:moc_qxtstringspinbox.cpp:(.text.startup+0x3): undefined reference to `__imp__ZN16QxtStringSpinBox16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0xb): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x61): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0xa1): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0xe1): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x121): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x238): undefined reference to `__imp__ZN13QxtSpanSlider16setLowerPositionEi'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x248): undefined reference to `__imp__ZN13QxtSpanSlider16setUpperPositionEi'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x287): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x2b2): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x2f2): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x332): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x372): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x3a8): undefined reference to `__imp__ZN13QxtSpanSlider13setLowerValueEi'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x3b9): undefined reference to `__imp__ZN13QxtSpanSlider13setUpperValueEi'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x3d1): undefined reference to `__imp__ZN13QxtSpanSlider7setSpanEii'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x402): undefined reference to `__imp__ZNK13QxtSpanSlider18handleMovementModeEv'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x412): undefined reference to `__imp__ZNK13QxtSpanSlider10upperValueEv'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x422): undefined reference to `__imp__ZNK13QxtSpanSlider10lowerValueEv'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x432): undefined reference to `__imp__ZNK13QxtSpanSlider13upperPositionEv'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x442): undefined reference to `__imp__ZNK13QxtSpanSlider13lowerPositionEv'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x452): undefined reference to `__imp__ZN13QxtSpanSlider16setUpperPositionEi'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x462): undefined reference to `__imp__ZN13QxtSpanSlider16setLowerPositionEi'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x472): undefined reference to `__imp__ZN13QxtSpanSlider13setUpperValueEi'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x482): undefined reference to `__imp__ZN13QxtSpanSlider13setLowerValueEi'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x492): undefined reference to `__imp__ZN13QxtSpanSlider21setHandleMovementModeENS_18HandleMovementModeE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text+0x4f5): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
release/moc_qxtspanslider.o:moc_qxtspanslider.cpp:(.text.startup+0x3): undefined reference to `__imp__ZN13QxtSpanSlider16staticMetaObjectE'
Hat jemand eine Idee, warum das unter Windows schief läuft, unter Linux und macOS jedoch nicht?

Den kompletten Source-Code gibt es hier:

https://github.com/GoaSkin/qKontrol

GoaSkin
Beiträge: 102
Registriert: 13. Juni 2007 00:14
Wohnort: Darmstadt

Re: Warum lässt sich mein Programm nicht unter Windows mit MinGW linken?

Beitrag von GoaSkin » 1. Mai 2020 19:05

Thema gelöst. Nachdem ich mir den Sourcecode von QXT angeschaut habe, braucht man eine zusätzliche Definition in der Projekt-Datei, die unter den anderen Betriebssystemen nicht erforderlich ist. In der Projektdatei muss die folgende Zeile rein:

Code: Alles auswählen

win32: DEFINES += QXT_STATIC

Antworten