Hi everyone , today i wanted to add the email sending functionality in my Qt program so i decided to use Qxt …
i installed it by following this steps :
Download Qxt 0.6
Exctrat it in Qt’s folder , exactly in libqxt folder
Launch Qt’s cmd and typed this commands :
# cd libqxt
# configure.bat
# configure -debug_and_release
# mingw32-make
# mingw32-make install
Once the installation finished , i opened my Qt project and added in the .pro file :
CONFIG += qxt
QXT += core gui
QT += network // to use networking
QXT_DIR = D:/Qt/qt/libqxt
INCLUDEPATH += D:/Qt/qt/libqxt/include
after that i began coding and there is the result :
#include <QApplication>
#include <QxtNetwork/qxtmailmessage.h>
#include <QxtNetwork/qxtsmtp.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QxtMailMessage *message = new QxtMailMessage;
message->setSender("XXXX@gmail.com");
message->addRecipient("XXXX@gmail.com");
message->setSubject("Alarm");
message->setBody("Alarm message.");
QxtSmtp *smtp = new QxtSmtp;
smtp->setUsername("XXXX@gmail.com");
smtp->setPassword("******");
smtp->connectToSecureHost("smtp.gmail.com");
smtp->send(*message);
return a.exec();
}
When i compile i got this error message :
mingw32-make: Entering directory `D:/Qt/qt/iseeyou-build-desktop’
D:/Qt/mingw/bin/mingw32-make -f Makefile.Release all
mingw32-make1: Entering directory `D:/Qt/qt/iseeyou-build-desktop’
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQXT_GUI_LIB -DQXT_CORE_LIB -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I”..\include\QtCore” -I”..\include\QtNetwork” -I”..\include\QtGui” -I”..\include” -I“d:\Qt\qt\include\QxtCore” -I“d:\Qt\qt\include\QxtGui” -I”..\libqxt\include” -I”..\libqxt\include\QxtCore” -I”..\libqxt\src\core” -I”..\libqxt\include\QxtGui” -I”..\libqxt\src\gui” -I“c:\Qxt\include” -I“c:\Qxt\include\QxtGui” -I“c:\Qxt\include\QxtCore” -I”..\include\ActiveQt” -I“tmp\moc\release_shared” -I”..\iseeyou” -I”.” -I”..\mkspecs\win32-g++” -o tmp\obj\release_shared\test.o ..\iseeyou\test.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o release\iseeyou.exe tmp/obj/release_shared/test.o -L“d:\Qt\qt\lib” -L“d:\Qt\qt\lib” -lmingw32 -lqtmain -lQxtCore -lQxtGui -LC:/Qxt/lib -lQxtGui -lQxtCore -lQtGui4 -lQtNetwork4 -lQtCore4
tmp/obj/release_shared/test.o:test.cpp:(.text+0×3f): undefined reference to `_imp___ZN14QxtMailMessageC1Ev’
tmp/obj/release_shared/test.o:test.cpp:(.text+0×6b): undefined reference to `_imp___ZN14QxtMailMessage9setSenderERK7QString’
tmp/obj/release_shared/test.o:test.cpp:(.text+0xab): undefined reference to `_imp___ZN14QxtMailMessage12addRecipientERK7QStringNS_13RecipientTypeE’
tmp/obj/release_shared/test.o:test.cpp:(.text+0xe3): undefined reference to `_imp___ZN14QxtMailMessage10setSubjectERK7QString’
tmp/obj/release_shared/test.o:test.cpp:(.text+0×11b): undefined reference to `_imp___ZN14QxtMailMessage7setBodyERK7QString’
tmp/obj/release_shared/test.o:test.cpp:(.text+0×14c): undefined reference to `_imp___ZN7QxtSmtpC1EP7QObject’
tmp/obj/release_shared/test.o:test.cpp:(.text+0×178): undefined reference to `_imp___ZN7QxtSmtp11setUsernameERK10QByteArray’
tmp/obj/release_shared/test.o:test.cpp:(.text+0×1b7): undefined reference to `_imp___ZN7QxtSmtp11setPasswordERK10QByteArray’
tmp/obj/release_shared/test.o:test.cpp:(.text+0×200): undefined reference to `_imp___ZN7QxtSmtp19connectToSecureHostERK7QStringt’
tmp/obj/release_shared/test.o:test.cpp:(.text+0×21b): undefined reference to `_imp___ZN7QxtSmtp4sendERK14QxtMailMessage’
collect2: ld returned 1 exit status
Thanks for helping me :)
↧