Results 1 to 20 of 20

Thread: QT + eclipse

  1. #1

    Default QT + eclipse

    Hi!

    I'm a newbie on QT and eclipse. I searched a long the forum before ask.

    I installed QT, eclipse, qt-eclipse integration, mingw and msys on my windows 64 system.

    I created a Qt GUI project, and start coding some class to receive mail throught pop3, all is fine but when i tried to compile/exectute i get a wierd error on console output:

    mingw32-make all
    mingw32-make -f Makefile.Release all
    mingw32-make[1]: Entering directory `C:/Documents and Settings/Eric Draven/workspace/qpop3'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o "release\qpop3.exe" release\main.o release\qpop3.o release\moc_qpop3.o -L"d:\Qt\4.3.2\lib" -lmingw32 -lqtmain -lQtGui4 -lQtCore4
    release\qpop3.o:qpop3.cpp:(.text+0x135): undefined reference to `_imp___ZN10QTcpSocketC1EP7QObject'
    release\qpop3.o:qpop3.cpp:(.text+0x188): undefined reference to `_imp___ZN15QAbstractSocket13connectToHostERK7QStr ingt6QFlagsIN9QIODevice12OpenModeFlagEE'
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [release\qpop3.exe] Error 1
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/Eric Draven/workspace/qpop3'
    mingw32-make: *** [release-all] Error 2
    Any idea? what is missed?

    Thanks!!

    Alberich
    Last edited by jacek; 24th November 2007 at 18:09. Reason: changed [code] to [quote]

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    You don't link your application with QtNetwork library.

  3. #3

    Default Re: QT + eclipse

    i got this include on qpop3.h

    #include <QTnetwork/QTcpSocket.h>

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    Including a header is not enough. You have to tell Eclipse to link QtNetwork module with your application. I don't use Eclipse for Qt development, but you should be able to set which Qt modules you want to use in project's settings.

  5. #5

    Default Re: QT + eclipse

    which IDE you use?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    Quote Originally Posted by alberich View Post
    which IDE you use?
    I use KDevelop.

  7. #7

    Default Re: QT + eclipse

    and for windows?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    Quote Originally Posted by alberich View Post
    and for windows?
    I don't use windows for development.

  9. #9

    Default Re: QT + eclipse

    Ok, thanks!!

    One more question, i linked qtnetwork module but i get the following error on ld:

    mingw32-make all
    mingw32-make -f Makefile.Release all
    mingw32-make[1]: Entering directory `C:/Documents and Settings/Eric Draven/workspace/qpop3'
    mingw32-make[1]: Nothing to be done for `all'.
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/Eric Draven/workspace/qpop3'
    mingw32-make -f Makefile.Debug all
    mingw32-make[1]: Entering directory `C:/Documents and Settings/Eric Draven/workspace/qpop3'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o "debug\qpop3.exe" debug\main.o debug\qpop3.o debug\moc_qpop3.o -L"d:\Qt\4.3.2\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtNetworkd4 -lQtCored4
    D:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\ mingw32\bin\ld.exe: cannot find -lqtmaind
    collect2: ld returned 1 exit status
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/Eric Draven/workspace/qpop3'
    mingw32-make[1]: *** [debug\qpop3.exe] Error 1
    mingw32-make: *** [debug-all] Error 2
    Any idea? sorry, for this stupid questions
    Last edited by jacek; 25th November 2007 at 22:31. Reason: changed [code] to [quote]

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    Quote Originally Posted by alberich View Post
    D:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\ mingw32\bin\ld.exe: cannot find -lqtmaind
    You don't have the debug versions of Qt libraries. There should be a link in Start menu --- "Build Qt libraries in debug mode" or something like that.

  11. #11
    Join Date
    Nov 2007
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Red face Re: QT + eclipse

    I have downloaded and installed the Eclipse 3.3 and the Qt Eclipse Integration for Windows. I need a Qt package and I am asking for recommendations.
    Thanks,
    Bob
    Last edited by satlcard12; 27th November 2007 at 02:11. Reason: updated contents

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    Quote Originally Posted by satlcard12 View Post
    I need a Qt package and I am asking for recommendations.
    What recommendations do you expect from us? Just download the newest version from Trolltech.

  13. #13

    Default Re: QT + eclipse

    Jacek,

    Now i got debug libreries builded. When i build them i get other errors..
    mingw32-make
    mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `C:/Documents and Settings/Eric Draven/workspace/qpop3'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\Qt\4.3.2\include\QtCore" -I"d:\Qt\4.3.2\include\QtCore" -I"d:\Qt\4.3.2\include\QtGui" -I"d:\Qt\4.3.2\include\QtGui" -I"d:\Qt\4.3.2\include" -I"core" -I"gui" -I"network" -I"d:\Qt\4.3.2\include\ActiveQt" -I"debug" -I"." -I"d:\Qt\4.3.2\mkspecs\win32-g++" -o debug\main.o main.cpp
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\Qt\4.3.2\include\QtCore" -I"d:\Qt\4.3.2\include\QtCore" -I"d:\Qt\4.3.2\include\QtGui" -I"d:\Qt\4.3.2\include\QtGui" -I"d:\Qt\4.3.2\include" -I"core" -I"gui" -I"network" -I"d:\Qt\4.3.2\include\ActiveQt" -I"debug" -I"." -I"d:\Qt\4.3.2\mkspecs\win32-g++" -o debug\qpop3.o qpop3.cpp
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o "debug\qpop3.exe" debug\main.o debug\qpop3.o -L"d:\Qt\4.3.2\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
    debug\qpop3.o(.text+0x11f): In function `ZN5QPop3C2EP7QObject':
    C:/Documents and Settings/Eric Draven/workspace/qpop3/qpop3.cpp:7: undefined reference to `vtable for QPop3'
    debug\qpop3.o(.text+0x145): In function `ZN5QPop3C1EP7QObject':
    C:/Documents and Settings/Eric Draven/workspace/qpop3/qpop3.cpp:7: undefined reference to `vtable for QPop3'
    debug\qpop3.o(.text+0x1b5): In function `ZN5QPop37connectER7QStringt':
    C:/Documents and Settings/Eric Draven/workspace/qpop3/qpop3.cpp:19: undefined reference to `_imp___ZN10QTcpSocketC1EP7QObject'
    debug\qpop3.o(.text+0x239):C:/Documents and Settings/Eric Draven/workspace/qpop3/qpop3.cpp:22: undefined reference to `_imp___ZN15QAbstractSocket13connectToHostERK7QStr ingt6QFlagsIN9QIODevice12OpenModeFlagEE'
    debug\qpop3.o(.text+0x2d3): In function `ZN5QPop315socketConnectedEv':
    C:/Documents and Settings/Eric Draven/workspace/qpop3/qpop3.cpp:37: undefined reference to `QPop3::ConnStateChanged(int)'
    debug\qpop3.o(.text+0x2f5): In function `ZN5QPop311socketErrorEN15QAbstractSocket11SocketE rrorE':
    C:/Documents and Settings/Eric Draven/workspace/qpop3/qpop3.cpp:49: undefined reference to `QPop3::ConnStateChanged(int)'
    debug\qpop3.o(.text+0x310):C:/Documents and Settings/Eric Draven/workspace/qpop3/qpop3.cpp:52: undefined reference to `QPop3::ConnStateChanged(int)'
    collect2: ld returned 1 exit status
    mingw32-make[1]: Leaving directory `C:/Documents and Settings/Eric Draven/workspace/qpop3'
    mingw32-make[1]: *** [debug\qpop3.exe] Error 1
    mingw32-make: *** [debug] Error 2
    And some other weid error like the ones i got before to link network module to my project.

    Thinking that coudl be mingw vesion, i build all ( qt and qt debug ) with the same version but get the same..

    Thanks!

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    Quote Originally Posted by alberich View Post
    And some other weid error like the ones i got before to link network module to my project.
    For some reason you don't link your project with QtNetwork module again. Also make sure that there's Q_OBJECT macro inside QPop3 definition (you will have to run qmake after adding it).

  15. #15

    Default Re: QT + eclipse

    For some reason you don't link your project with QtNetwork module again. Also make sure that there's Q_OBJECT macro inside QPop3 definition (you will have to run qmake after adding it).
    Both are done. I got qtnetwork module, and Q_OBJECT declared inside QPop3. This starts just after i builded debug libraries.

    thanks

  16. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    Quote Originally Posted by alberich View Post
    Both are done. I got qtnetwork module, and Q_OBJECT declared inside QPop3. This starts just after i builded debug libraries.
    If your .pro file is OK (i.e. it contains "QT += network" or equivalent), then you have to force Eclipse to re-run qmake to generate new makefiles.

  17. #17

    Default Re: QT + eclipse

    I done qmake several times, maybe there's something wrong with my code?

    Qt Code:
    1. #ifndef __POP3_H_INCLUDED__
    2. #define __POP3_H_INCLUDED__
    3.  
    4.  
    5. #include <QtGui/QWidget>
    6. //#include "ui_qpop3.h"
    7.  
    8. #include <QDialog>
    9. #include <QtCore/QObject.h>
    10. //#include <QTnetwork>
    11. #include <QTnetwork/QTcpSocket.h>
    12.  
    13. //#include <QTcpSocket>
    14. #include <QtCore/qstring.h>
    15.  
    16.  
    17. class QPop3 : public QObject
    18. {
    19. Q_OBJECT
    20. private:
    21.  
    22. QTcpSocket *socket;
    23. public:
    24. enum ConnectState{
    25. CsHostFound,
    26. CsConnected,
    27. CsClosed,
    28. CsHostNotFound,
    29. CsConnectionRefused
    30. };
    31.  
    32. // Constructor
    33. explicit QPop3(QObject *parent = 0);
    34. virtual ~QPop3();
    35.  
    36. int connect(QString &servAdr,quint16 port);
    37.  
    38.  
    39. signals:
    40. void ConnStateChanged(int);
    41.  
    42. private slots:
    43. void socketError(QAbstractSocket::SocketError e);
    44. void socketConnected();
    45.  
    46. };
    47.  
    48. #endif
    To copy to clipboard, switch view to plain text mode 

    Thanks once again

  18. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    Quote Originally Posted by alberich View Post
    I done qmake several times, maybe there's something wrong with my code?
    The code looks OK. Do you run "qmake" or "qmake -project"? The former creates makefiles from your .pro file, while the latter generates a new .pro file overwriting the old one (you should run this only once at the beginning of your project).

  19. #19
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT + eclipse

    I've installed Qt-Eclipse integration on my system. It seems that as long as you have a correct .pro file, "Build Project" or "Build Make Target..." should do the magic. Eclipse is quite unstable on my system and I couldn't make Qt Project Editor to run, so I don't know how it looks like, but you can also open your .proi file in text editor to check if it's OK --- all your .h files should be listed in HEADERS variable, .cpp files in SOURCES and .ui files in FORMS. Also QT should contain at least "core", "gui" and "network".

  20. #20

    Default Re: QT + eclipse

    I created another project, and put back the files and then all worked.

    I supposed, as you said, .pro file was wrong but this is the next level :P

    Thanks for all

Similar Threads

  1. Replies: 7
    Last Post: 22nd December 2010, 08:13
  2. Custom Widget on Eclipse Integration
    By battousaihimura in forum Qt Tools
    Replies: 2
    Last Post: 11th October 2007, 12:40
  3. Replies: 0
    Last Post: 21st September 2007, 11:08
  4. [MacOSX,eclipse CDT]want eclipse to know Qt classes
    By lolveley in forum Installation and Deployment
    Replies: 7
    Last Post: 27th July 2007, 23:52
  5. Howto use Eclipse with QT4 in 10 steps
    By the_bis in forum Newbie
    Replies: 3
    Last Post: 28th January 2007, 20:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.