Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Undefined reference to EVERYTHING

Undefined reference to EVERYTHING

Scheduled Pinned Locked Moved Installation and Deployment
7 Posts 3 Posters 6.4k Views
  • 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.
  • G Offline
    G Offline
    Geekface
    wrote on last edited by
    #1

    My problem is pretty simple: [url=http://www.yaharr.com/i/qt_1331errors.png]Everything is an undefined reference (CLICK FOR SCREENSHOT)[/url].

    This project was not made by me. It compiles just fine on it's author's computer with Qt Creator (on Windows 7).

    When I open the CMakeLists.txt with Qt (File > Open File or Project...) and Build All (Build > Build All), however, I get over a thousand errors due to everything being an undefined reference.

    • I'm using Windows 7 Professional 64-bit
    • I'm using MinGW 4.4 to compile - the same MinGW 4.4 that comes with Qt Creator's installer.
    • I have CMake 2.8
    • My packages are here: [url=http://www.yaharr.com/i/qt_packages2.png]Screenshot[/url] (updated)
    • Here's the part of my PATH variable that isn't just basic system stuff:
      ... C:\Program Files\Java\jre6\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\CMake 2.8\bin;C:\Program Files (x86)\QuickTime\QTSystem;C:\Dynamic\QtSDK\mingw\bin;C:\Dynamic\QtSDK\Desktop\Qt\4.7.4\msvc2008\bin;C:\Dynamic\QtSDK\Desktop\Qt\4.7.4\mingw\bin

    To reiterate, this project compiles just fine on another Windows 7 PC.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      My guess is, that you are trying to link against another version of the Qt libraries than the one you are #including somehow.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Geekface
        wrote on last edited by
        #3

        @Andre: How do we determine which library versions we're referencing?

        We're both using the same version of Desktop Qt.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          Well, you might take a look at the commands qmake is generating / make is executing (and post them here).

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Geekface
            wrote on last edited by
            #5

            -How would I obtain that information?-

            EDIT: Our makefile (CMakeLists.txt) contains this:

            @project(flist_messenger)
            cmake_minimum_required(VERSION 2.6)
            find_package(Qt4 REQUIRED)

            include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} "../libjson/Source")

            set(flist_messenger_SRCS ../libjson/Source/internalJSONNode.cpp ../libjson/Source/JSONNode.cpp ../libjson/Source/JSONChildren.cpp ../libjson/Source/JSONDebug.cpp
            ../libjson/Source/JSONMemory.cpp ../libjson/Source/JSONWorker.cpp ../libjson/Source/JSONWriter.cpp
            flist_avatar.cpp flist_character.cpp flist_sound.cpp main.cpp
            flist_channel.cpp flist_messenger.cpp flist_userlist.cpp flist_parser.cpp)
            SET(flist_messenger_HEADERS flist_avatar.h flist_character.h)
            set(QtApp_RCCS resources.qrc)

            QT4_WRAP_CPP(flist_messenger_HEADERS_MOC ${flist_messenger_HEADERS})
            QT4_ADD_RESOURCES(QtApp_RCC_SRCS ${QtApp_RCCS})
            qt4_automoc(${flist_messenger_SRCS})
            add_executable(flist_messenger ${flist_messenger_SRCS} ${QtApp_RCC_SRCS} ${flist_messenger_HEADERS_MOC})
            target_link_libraries(flist_messenger ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY})@

            The information in the Compile Output tab follows:

            @Running build steps for project flist_messenger...
            Starting: "C:\Dynamic\QtSDK\mingw\bin\mingw32-make.exe"
            Linking CXX executable flist_messenger.exe
            CMakeFiles\flist_messenger.dir/objects.a(flist_avatar.cpp.obj):flist_avatar.cpp:(.text+0x16): undefined reference to _imp___ZN7QObjectC2EPS_' CMakeFiles\flist_messenger.dir/objects.a(flist_avatar.cpp.obj):flist_avatar.cpp:(.text+0x53): undefined reference to _imp___ZN21QNetworkAccessManagerC1EP7QObject'

            <it continues like this for ~1500 lines>

            CMakeFiles\flist_messenger.dir/objects.a(moc_flist_avatar.cxx.obj):moc_flist_avatar.cxx:(.rdata$_ZTV7FAvatar[vtable for FAvatar]+0x34): undefined reference to QObject::disconnectNotify(char const*)' CMakeFiles\flist_messenger.dir/objects.a(moc_flist_avatar.cxx.obj):moc_flist_avatar.cxx:(.text$_ZN7FAvatarD0Ev[FAvatar::~FAvatar()]+0x1b): undefined reference to _imp___ZN21QNetworkAccessManagerD1Ev'
            CMakeFiles\flist_messenger.dir/objects.a(moc_flist_avatar.cxx.obj):moc_flist_avatar.cxx:(.text$_ZN7FAvatarD0Ev[FAvatar::~FAvatar()]+0x78): undefined reference to _imp___ZN7QObjectD2Ev' CMakeFiles\flist_messenger.dir/objects.a(moc_flist_avatar.cxx.obj):moc_flist_avatar.cxx:(.text$_ZN7FAvatarD0Ev[FAvatar::~FAvatar()]+0x94): undefined reference to _imp___ZN7QObjectD2Ev'
            collect2: ld returned 1 exit status
            mingw32-make[2]: *** [flist_messenger.exe] Error 1
            mingw32-make[1]: *** [CMakeFiles/flist_messenger.dir/all] Error 2
            mingw32-make: *** [all] Error 2
            The process "C:\Dynamic\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
            Error while building project flist_messenger (target: Desktop)
            When executing build step 'Make'@

            (The full output is [url=http://www.yaharr.com/i/make-output.txt]here[/url])

            Is that the information you're after?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              The acutal call to the linker would be interesting, especially which pathes and libraries get passed.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Geekface
                wrote on last edited by
                #7

                [quote author="Lukas Geyer" date="1321879284"]The acutal call to the linker would be interesting, especially which pathes and libraries get passed.[/quote]
                How do I acquire that call information?

                This is my first time dealing with makefiles, and my usage of C++ compilers (apart from Visual Studio's) has just involved single-document scripts.

                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