PDA

View Full Version : error: collect2: ld returned 1 exit status



Splatify
13th February 2011, 17:58
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!



Running build steps for project test...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Users/../../../../test-build-desktop'

C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug

mingw32-make[1]: Entering directory `C:/Users/../../../../test-build-desktop'

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

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

mingw32-make[1]: Leaving directory `C:/Users/../../../../test-build-desktop'

mingw32-make: Leaving directory `C:/Users/../../../../test-build-desktop'

./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)'

./debug\logindialog.o:c:/Qt/2010.05/qt/include/QtGui/../../src/gui/kernel/qwidget.h:487: first defined here

./debug\userwindow.o:C:\Users\../../../../test-build-desktop/../test/database.h:44: multiple definition of `database::DConnect()'

./debug\logindialog.o:C:\Users\../../../../test-build-desktop/../test/database.h:44: first defined here

collect2: ld returned 1 exit status

mingw32-make[1]: *** [debug\test.exe] Error 1

mingw32-make: *** [debug] Error 2

The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project test (target: Desktop)
When executing build step 'Make'


Thanks for your time and trouble

squidge
13th February 2011, 18:02
database.h:44: multiple definition of `database::DConnect()'

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

Splatify
13th February 2011, 18:09
Your amazing!!!! I have it working now... found the problem

Thanks for your time and trouble