Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. collect2.exe: error: ld returned 1 exit status
Forum Updated to NodeBB v4.3 + New Features

collect2.exe: error: ld returned 1 exit status

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    babravahan
    wrote on last edited by
    #1

    HI,
    I have using qt4.8.4 and GNUWIN32 compiler , when ever i try running make i encounter following error on my windows system.

    D:\QT\test>qmake -project

    D:\QT\test>qmake test.pro

    D:\QT\test>make
    make -f Makefile.Debug
    make[1]: Entering directory D:/QT/test' g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE tCore" -I"c:\Qt\4.8.4\include\QtGui" -I"c:\Qt\4.8.4\include" -I"." -I"c:\Qt\4.8.4\include\ActiveQt" -I"debug" -I"c:\Qt\4.8.4\mkspecs\default" -o debug\test.o test.cpp g++ -mthreads -Wl,-subsystem,windows -o debug\test.exe debug/test.o -L"c:\Qt\4.8.4\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 debug/test.o: In function main':
    D:\QT\test/test.cpp:5: undefined reference to _imp___ZN12QApplicationC1ERiPPci' D:\QT\test/test.cpp:6: undefined reference to _imp___ZN6QLabelC1ERK7QStringP7QWidget6QFlagsIN2Qt10WindowTypeEE'
    D:\QT\test/test.cpp:8: undefined reference to _imp___ZN12QApplication4execEv' D:\QT\test/test.cpp:8: undefined reference to _imp___ZN12QApplicationD1Ev'
    D:\QT\test/test.cpp:8: undefined reference to _imp___ZN12QApplicationD1Ev' debug/test.o: In function ZN7QStringC1EPKc':
    c:/Qt/4.8.4/include/QtCore/../../src/corelib/tools/qstring.h:419: undefined reference to _imp___ZN7QString16fromAscii_helperEPKci' debug/test.o: In function ZN7QStringD1Ev':
    c:/Qt/4.8.4/include/QtCore/../../src/corelib/tools/qstring.h:880: undefined reference to _imp___ZN7QString4freeEPNS_4DataE' collect2.exe: error: ld returned 1 exit status make[1]: *** [debug\test.exe] Error 1 make[1]: Leaving directory D:/QT/test'
    make: *** [debug] Error 2

    1 Reply Last reply
    0
    • kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      Hello,
      Are your qmake and Qt libraries compiled with the same comiler? If not this is the reason you get the undefined references. MSVS and mingw use different decorations and are not binary compatible.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      B 1 Reply Last reply
      0
      • kshegunovK kshegunov

        Hello,
        Are your qmake and Qt libraries compiled with the same comiler? If not this is the reason you get the undefined references. MSVS and mingw use different decorations and are not binary compatible.

        Kind regards.

        B Offline
        B Offline
        babravahan
        wrote on last edited by
        #3

        @kshegunov is there any reference documentation where in qt installation on windows 7 is present.

        kshegunovK 1 Reply Last reply
        0
        • B babravahan

          @kshegunov is there any reference documentation where in qt installation on windows 7 is present.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by kshegunov
          #4

          @babravahan
          Just look up what you've installed in the "Qt maintenance tool", there are a few checkboxes for different versions/compilers, look at what you've checked. Or try to get that from qmake, running qmake -v should give you the Qt version and the compiler used.

          Kind regards.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved