Reputation: 941
I am migrating a huge project from Qt4.x to Qt5. Right now I am having this issue that I can't solve:
C:\Qt5\5.2.1\mingw48_32\lib/libQt5Core.a(d003170.o):(.text+0x0): multiple definition of `QString::fromUtf8(char const*, int)'
./release\aisinfowidget.o:aisinfowidget.cpp:(.text$_ZN7QString8fromUtf8EPKci[__ZN7QString8fromUtf8EPKci]+0x0): first defined here
./release\gpssettingswidget.o:gpssettingswidget.cpp:(.text+0x4dcc): undefined reference to `QtAddOn::SerialPort::SerialPortInfo::availablePorts()'
./release\gpssettingswidget.o:gpssettingswidget.cpp:(.text+0x4e3e): undefined reference to `QtAddOn::SerialPort::SerialPortInfo::portName() const'
./release\gpssettingswidget.o:gpssettingswidget.cpp:(.text+0x4e5d): undefined reference to `QtAddOn::SerialPort::SerialPortInfo::description() const'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\gpssettingswidget.o: bad reloc address 0xd in section `.text$_ZN25Ui_GPSSettingsWidgetClass13retranslateUiEP14SettingsWidget[__ZN25Ui_GPSSettingsWidgetClass13retranslateUiEP14SettingsWidget]'
collect2.exe: error: ld returned 1 exit status
Upvotes: 1
Views: 1118
Reputation: 5978
I saw you are using third party library QtSerialPort
and QextSerialPort
. Lucky you, I've been struggling with these two lovely guys these days.
The errors QString::fromUtf8
"possibly" come from the macro QStringLiteral
defined in qserialportglobal.h
#ifndef QStringLiteral
#define QStringLiteral(str) QString::fromUtf8(str)
#endif
P.S. I am using Qt 4.8.5, there might be some difference.
In your gpssettingswidget.cpp, you don't have to include qserialportglobal.h
again since it has been included in QSerialPort
.
Remove the inclusion and see if it gets better, I know it's an arduous work to deal those multiple errors, and this answer definitely not the final remedy.
At least see what changes, and we can discuss here.
[Edit]
I saw you are using Qwt
too, I had a problem when using Qwt
and QtSerialPort
together. The question is here and has not yet been solved. I bypassed the conflict by migrating to QextSerialPort
. There might be some library conflict, I doubt.
It seems that only Laszlo Papp can save your ass (He is one of the author of QtSerialPort
)
Upvotes: 1