Results 1 to 3 of 3

Thread: error: collect2: ld returned 1 exit status

  1. #1
    Join Date
    Oct 2010
    Posts
    54
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question error: collect2: ld returned 1 exit status

    Hi whenever i inlcude a header, in this case <database.h> to one of my .cpp files i get this error, "error: collect2: ld returned 1 exit status", when i remove this header everything compiles fine. I have used this header within other .cpp files so why is it not working now? any help would be much appreciated!


    Qt Code:
    1. Running build steps for project test...
    2. Configuration unchanged, skipping qmake step.
    3. Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
    4. mingw32-make: Entering directory `C:/Users/../../../../test-build-desktop'
    5.  
    6. C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug
    7.  
    8. mingw32-make[1]: Entering directory `C:/Users/../../../../test-build-desktop'
    9.  
    10. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\2010.05\qt\include\QtCore" -I"c:\Qt\2010.05\qt\include\QtGui" -I"c:\Qt\2010.05\qt\include\QtSql" -I"c:\Qt\2010.05\qt\include" -I"c:\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"." -I"..\test" -I"." -I"c:\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\userwindow.o ..\test\userwindow.cpp
    11.  
    12. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\test.exe object_script.test.Debug -L"c:\Qt\2010.05\qt\lib" -lmingw32 -lqtmaind -lQtSqld4 -lQtGuid4 -lQtCored4
    13.  
    14. mingw32-make[1]: Leaving directory `C:/Users/../../../../test-build-desktop'
    15.  
    16. mingw32-make: Leaving directory `C:/Users/../../../../test-build-desktop'
    17.  
    18. ./debug\userwindow.o:c:/Qt/2010.05/qt/include/QtCore/../../src/corelib/thread/qbasicatomic.h:73: multiple definition of `database::DSettings(int, QString, QString, QString, QString)'
    19.  
    20. ./debug\logindialog.o:c:/Qt/2010.05/qt/include/QtGui/../../src/gui/kernel/qwidget.h:487: first defined here
    21.  
    22. ./debug\userwindow.o:C:\Users\../../../../test-build-desktop/../test/database.h:44: multiple definition of `database::DConnect()'
    23.  
    24. ./debug\logindialog.o:C:\Users\../../../../test-build-desktop/../test/database.h:44: first defined here
    25.  
    26. collect2: ld returned 1 exit status
    27.  
    28. mingw32-make[1]: *** [debug\test.exe] Error 1
    29.  
    30. mingw32-make: *** [debug] Error 2
    31.  
    32. The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
    33. Error while building project test (target: Desktop)
    34. When executing build step 'Make'
    To copy to clipboard, switch view to plain text mode 

    Thanks for your time and trouble

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: error: collect2: ld returned 1 exit status

    database.h:44: multiple definition of `database::DConnect()'

    I'd say thats the problem. You have definitions in header code rather than just declarations.

  3. #3
    Join Date
    Oct 2010
    Posts
    54
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: error: collect2: ld returned 1 exit status

    Your amazing!!!! I have it working now... found the problem

    Thanks for your time and trouble

Similar Threads

  1. Replies: 7
    Last Post: 10th February 2011, 23:35
  2. error: collect2: ld returned 1 exit status
    By srohit24 in forum Qt Programming
    Replies: 3
    Last Post: 1st December 2009, 06:32
  3. error: collect2: ld returned 1 exit status
    By nataly in forum Qt Programming
    Replies: 4
    Last Post: 13th October 2009, 13:39
  4. collect2: ld returned 1 exit status error
    By gmsk19 in forum Qt Tools
    Replies: 11
    Last Post: 25th July 2009, 02:05
  5. collect2: ld returned 1 exit status
    By assismvla in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2009, 01:51

Tags for this Thread

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.