[Qxt + Qt + QxtSmtp] can't locate the problem



  • 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&#40;&#41;;
    

    }
    @
    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-make[1]: 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+0x3f): undefined reference to `_imp___ZN14QxtMailMessageC1Ev'

    tmp/obj/release_shared/test.o:test.cpp:(.text+0x6b): 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+0x11b): undefined reference to `_imp___ZN14QxtMailMessage7setBodyERK7QString'

    tmp/obj/release_shared/test.o:test.cpp:(.text+0x14c): undefined reference to `_imp___ZN7QxtSmtpC1EP7QObject'

    tmp/obj/release_shared/test.o:test.cpp:(.text+0x178): undefined reference to `_imp___ZN7QxtSmtp11setUsernameERK10QByteArray'

    tmp/obj/release_shared/test.o:test.cpp:(.text+0x1b7): undefined reference to `_imp___ZN7QxtSmtp11setPasswordERK10QByteArray'

    tmp/obj/release_shared/test.o:test.cpp:(.text+0x200): undefined reference to `_imp___ZN7QxtSmtp19connectToSecureHostERK7QStringt'

    tmp/obj/release_shared/test.o:test.cpp:(.text+0x21b): undefined reference to `_imp___ZN7QxtSmtp4sendERK14QxtMailMessage'

    collect2: ld returned 1 exit status

    Thanks for helping me :)



  • Any idea ? :(


  • Moderators

    Please be patient; it has only been 5 hours. Normally, people wait a few days before bumping a thread.

    [quote]collect2: ld returned 1 exit status[/quote]This line doesn't provide much information at all; the actual errors are listed before this line.

    But anyway, you haven't told Qt to link to your Qxt library. See http://stackoverflow.com/questions/1565732/libqxt-under-qt-creator



  • Ok sorry i'm not used to post on forums ^^" , i edited with the full error message , i tried all the propositions posted on that topic but still doesn't work :/ and by the way i noticed during the execution of mingw31-make this error message :
    @compiling qxtsmtp.cpp
    qxtsmtp.cpp: In member function 'void QxtSmtpPrivate::socketRead()':
    qxtsmtp.cpp:188: warning: enumeration value 'Disconnected' not handled in switch

    qxtsmtp.cpp:188: warning: enumeration value 'EhloExtensionsReceived' not handled
    in switch
    qxtsmtp.cpp:188: warning: enumeration value 'EhloDone' not handled in switch
    qxtsmtp.cpp:188: warning: enumeration value 'Authenticated' not handled in switc
    h
    qxtsmtp.cpp:188: warning: enumeration value 'Waiting' not handled in switch
    compiling qxttcpconnectionmanager.cpp
    moc qxtxmlrpccall.h
    compiling qxtxmlrpccall.cpp
    qxtxmlrpccall.cpp: In member function 'void QxtXmlRpcCallPrivate::d_finished()':

    qxtxmlrpccall.cpp:197: warning: unknown conversion type character 'l' in format
    qxtxmlrpccall.cpp:197: warning: unknown conversion type character 'l' in format
    qxtxmlrpccall.cpp:197: warning: too many arguments for format
    compiling qxtxmlrpcclient.cpp
    compiling qxtxmlrpc_p.cpp@

    And i think that some files are missing in the include and lib folders as QxtSmtp and QxtMailMessage ...
    Thanks for your help =)

    PS : i'm using Qt 4.0.7 and Qxt 0.6.2


  • Moderators

    [quote author="adramalex" date="1374635825"]Ok sorry i'm not used to post on forums ^^"[/quote]That's ok :) Welcome to the Qt DevNet! Thanks for posting back with more detailed information.

    [quote]tmp/obj/release_shared/test.o:test.cpp:(.text+0×3f): undefined reference to `_imp___ZN14QxtMailMessageC1Ev’[/quote]This is a linker error. After the compiler has finished compiling your code, the linker links your program to the 3rd-party libraries that your program depends on.

    In this case, the linker could not find the library that contains the QxtMailMessage() function. You need to tell the linker where to find it. This is normally done by adding the "LIBS" flags to your .pro file.

    [quote]i tried all the propositions posted on that topic but still doesn’t work [/quote]After you've edited your .pro file, you might need to run qmake again.

    [quote]
    @compiling qxtsmtp.cpp
    qxtsmtp.cpp: In member function 'void QxtSmtpPrivate::socketRead()':
    qxtsmtp.cpp:188: warning: enumeration value 'Disconnected' not handled in switch

    qxtsmtp.cpp:188: warning: enumeration value 'EhloExtensionsReceived' not handled
    in switch
    qxtsmtp.cpp:188: warning: enumeration value 'EhloDone' not handled in switch
    qxtsmtp.cpp:188: warning: enumeration value 'Authenticated' not handled in switc
    h
    qxtsmtp.cpp:188: warning: enumeration value 'Waiting' not handled in switch
    compiling qxttcpconnectionmanager.cpp
    moc qxtxmlrpccall.h
    compiling qxtxmlrpccall.cpp
    qxtxmlrpccall.cpp: In member function 'void QxtXmlRpcCallPrivate::d_finished()':

    qxtxmlrpccall.cpp:197: warning: unknown conversion type character 'l' in format
    qxtxmlrpccall.cpp:197: warning: unknown conversion type character 'l' in format
    qxtxmlrpccall.cpp:197: warning: too many arguments for format
    compiling qxtxmlrpcclient.cpp
    compiling qxtxmlrpc_p.cpp@
    [/quote]These are compiler warnings, which mean that the compiler found strange things in the Qxt code, that may or may not be an issue. The code might still work, but it is good practice to fix all warnings. The Qxt developers are responsible for fixing them.

    [quote]And i think that some files are missing in the include and lib folders as QxtSmtp and QxtMailMessage ...[/quote]If that's the case, you'll have to ask the Qxt developers to fix them. Please note that Qxt is a 3rd-party library that's not affiliated with the Qt Project.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.