I am migrating a project from Qt4.x to 5, I am almost finished but I am getting errors when linking libQxt. At first I downloaded the libQxt for Qt5 & compiled it with Qt5 then included them in the project, but it didnt solve any of the undefined references, (probably because there are deprecated functions and such) so I downloaded the libQxt for Qt4 and compiled the libraries using Qt4, and it did solve many of the undefined references, but I am still getting two errors, which shouldnt because the functions the errors refer to are in the included libraries.
These are the errors:
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x82b9): undefined reference to `_imp___ZN14QxtMailMessageC1ERK10QByteArray'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaebc): undefined reference to `_imp___ZNK17QxtMailAttachment7rawDataEv'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\csnmailbox.o: bad reloc address 0x1 in section `.text$_ZN16AttachmentsModelD1Ev[__ZN16AttachmentsModelD1Ev]'
collect2.exe: error: ld returned 1 exit status
And these are the linkings to the libraries:
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtCore.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtDesignerPlugins.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtGui.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtNetwork.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtSql.a" \
-l:"C:/Users/Sprint/Desktop/swe/marssies/libQxtWeb.a" \
If I comment the line that includes the libQxtnetwork (which is the one that the program really uses) there are more errors, so I dont understand why its not detecting those 2 functions. Here are the errors I get when I comment that line:
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x167): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x61c4): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x6227): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x62a7): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x6dac): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x73c9): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x7500): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x82b9): undefined reference to `_imp___ZN14QxtMailMessageC1ERK10QByteArray'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x85dc): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x8814): undefined reference to `_imp___ZN14QxtMailMessage14setExtraHeaderERK7QStringS2_'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x9b61): undefined reference to `_imp___ZNK14QxtMailMessage14hasExtraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0x9cad): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaaff): undefined reference to `_imp___ZNK14QxtMailMessage4bodyEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xab40): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xacb6): undefined reference to `_imp___ZNK14QxtMailMessage11attachmentsEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaeb0): undefined reference to `_imp___ZNK14QxtMailMessage10attachmentERK7QString'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaebc): undefined reference to `_imp___ZNK17QxtMailAttachment7rawDataEv'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xaee7): undefined reference to `_imp___ZN17QxtMailAttachmentD1Ev'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xafd2): undefined reference to `_imp___ZN17QxtMailAttachmentD1Ev'
./release\csnmailbox.o:csnmailbox.cpp:(.text+0xb695): undefined reference to `_imp___ZNK14QxtMailMessage11extraHeaderERK7QString'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: ./release\csnmailbox.o: bad reloc address 0x1 in section `.text$_ZN16AttachmentsModelD1Ev[__ZN16AttachmentsModelD1Ev]'
I hope someone can enlighten me with some knowledge. Thankyou very much.
EDIT: I managed to 'fix' those errors, I was missing something so simple as
#include <QxtNetwork>
(I didnt write this code, which makes porting harder than it should) Bad thing is I have very similar errors now:
..\marssies\csnmailbox.cpp: In member function 'void CSNMailBox::onAttachmentDoubleClicked(const QModelIndex&)':
..\marssies\csnmailbox.cpp:183:46: error: 'class QxtMailAttachment' has no member named 'rawData'
_f.write(_m->attachment(_fname.toLatin1()).rawData());
..\marssies\csnmailbox.cpp: In member function 'virtual void MailWorker::run()':
..\marssies\csnmailbox.cpp:491:57: error: no matching function for call to 'QxtMailMessage::QxtMailMessage(QByteArray)'
m_nm.append(__mm = new QxtMailMessage(_m.toLatin1()));
^
I will try to solve these now, at least I got past that point.
EDIT2: I have managed to solve the first error by changing rawData() to mimeData(), it must have been deprecated. I hope the functionality stays the same.
EDIT3: Apparently the last error is just an issue with the constructor:
QxtMailMessage* __mm= new QxtMailMessage(_m.toLatin1());
The constructor accepts either a QxtMailMessage object or qstrings sender, recipient, but I think _m is the message. I will have to ask who wrote the code, because the names of the variables dont help at all.
I can say the question has been solved. Thankyou.