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. Undefined reference to qDebug
Forum Updated to NodeBB v4.3 + New Features

Undefined reference to qDebug

Scheduled Pinned Locked Moved Unsolved General and Desktop
38 Posts 8 Posters 13.6k Views 4 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.
  • A Offline
    A Offline
    ayush_mistral
    wrote on last edited by
    #6

    Yes it was building before adding the cppunit library and header in the .pro file.

    Please find my .pro file as below.

    Thanks
    Ayush

    #-------------------------------------------------

    Project created by QtCreator 2016-01-22T17:45:53

    #-------------------------------------------------

    QT += core gui
    QT += network

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = cppunittest_gui
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp
    cmTcp.cpp
    cmUdp.cpp
    CommunicationModule.cpp
    CommunicationModuleTest.cpp
    CmTcpTest.cpp
    CmUdpTest.cpp

    HEADERS += mainwindow.h
    cmCommon.h
    cmTcp.h
    cmUdp.h
    CommunicationModule.h
    CommunicationModuleTest.h
    CmTcpTest.h
    CmUdpTest.h
    testconfig.h

    mistTypes.h
    

    FORMS += mainwindow.ui

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../usr/lib/release/ -lgtest
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../usr/lib/debug/ -lgtest
    else:unix: LIBS += -L$$PWD/../../../../../usr/lib/ -lgtest

    INCLUDEPATH += $$PWD/../../../../../usr/include/gtest
    DEPENDPATH += $$PWD/../../../../../usr/include/gtest

    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/release/libgtest.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/debug/libgtest.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/release/gtest.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/debug/gtest.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/libgtest.a

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../usr/lib/x86_64-linux-gnu/release/ -lcppunit
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../usr/lib/x86_64-linux-gnu/debug/ -lcppunit
    else:unix: LIBS += -L$$PWD/../../../../../usr/lib/x86_64-linux-gnu/ -lcppunit

    INCLUDEPATH += $$PWD/../../../../../usr/include/cppunit
    DEPENDPATH += $$PWD/../../../../../usr/include/cppunit

    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/x86_64-linux-gnu/release/libcppunit.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/x86_64-linux-gnu/debug/libcppunit.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/x86_64-linux-gnu/release/cppunit.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/x86_64-linux-gnu/debug/cppunit.lib
    else:unix: PRE_TARGETDEPS += $$PWD/../../../../../usr/lib/x86_64-linux-gnu/libcppunit.a

    1 Reply Last reply
    0
    • T Offline
      T Offline
      ttuna
      wrote on last edited by
      #7

      How did you use qDebug()? Can you post an example?

      A 1 Reply Last reply
      0
      • T ttuna

        How did you use qDebug()? Can you post an example?

        A Offline
        A Offline
        ayush_mistral
        wrote on last edited by
        #8

        @ttuna I used qdebug() for printing debug messages like below mentioned example

        qDebug() << "Socket Bounded";

        Ayush

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #9

          Hi,

          Maybe a silly question but did you #include <QtDebug> in your cpp file ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          0
          • A ayush_mistral

            Hi,

            I want to use test a QT Desktop GUI application project using CppUnit Framework.
            When I included the CppUnit Library path and the headers in the .pro file of the QT Project and build the project I am getting compiler error messages as "undefined reference to qDebug" . For example like this :
            /cmUdp.cpp:72: error: undefined reference to `QDebug::~QDebug()'.
            I included the Qdebug header in the source file,(#include <QDebug>) but still showing the error.

            Please help me to know what may be the probable cause of this error and what is the possible solution.

            Thanks in advance
            Ayush

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

            @ayush_mistral
            Hello,
            Do you mind putting the whole compilation window content somewhere for us to see (it may be long so perhaps uploading it to a site and linking it here is a good idea)?
            In the meantime, could you try linking the CppUnit Framework dynamically and let us know how it goes?

            Kind regards.

            Read and abide by the Qt Code of Conduct

            A 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Maybe a silly question but did you #include <QtDebug> in your cpp file ?

              A Offline
              A Offline
              ayush_mistral
              wrote on last edited by
              #11

              @SGaist

              Hi,

              I did #include <QtDebug> in my .cpp file but still its showing the same error as
              /QT Projects/cppunittest_gui/cmUdp.cpp:73: error: undefined reference to `QDebug::~QDebug()'

              Thanks and Regards
              Ayush

              1 Reply Last reply
              0
              • kshegunovK kshegunov

                @ayush_mistral
                Hello,
                Do you mind putting the whole compilation window content somewhere for us to see (it may be long so perhaps uploading it to a site and linking it here is a good idea)?
                In the meantime, could you try linking the CppUnit Framework dynamically and let us know how it goes?

                Kind regards.

                A Offline
                A Offline
                ayush_mistral
                wrote on last edited by
                #12

                @kshegunov

                Hi,

                I tried to link the cppunit library dynamically but still getting the same error as follows

                cmUdp.o: In function cCmUdp::cmUdpSocketInit(CM_UDPSOCKET_HANDLE*, HA_UDP_PARAM*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()'
                /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()' cmUdp.o: In function cCmUdp::cmUdpSocketRead(CM_UDPSOCKET_HANDLE*, char*, unsigned int)':
                /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()' /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()'
                cmUdp.o: In function cCmUdp::cmUdpSocketClose(CM_UDPSOCKET_HANDLE*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: undefined reference to QDebug::~QDebug()'
                cmUdp.o:/home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: more undefined references to `QDebug::~QDebug()' follow
                collect2: error: ld returned 1 exit status
                make: *** [cppunittest_gui] Error 1
                11:03:37: The process "/usr/bin/make" exited with code 2.
                Error while building/deploying project cppunittest_gui (kit: Desktop Qt 5.5.1 GCC 64bit)
                When executing step "Make"
                11:03:37: Elapsed time: 00:16.

                When I include the cppunit as a static library I am getting the output as follows

                cmUdp.o: In function cCmUdp::cmUdpSocketInit(CM_UDPSOCKET_HANDLE*, HA_UDP_PARAM*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()'
                /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()' cmUdp.o: In function cCmUdp::cmUdpSocketRead(CM_UDPSOCKET_HANDLE*, char*, unsigned int)':
                /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()' /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()'
                cmUdp.o: In function cCmUdp::cmUdpSocketClose(CM_UDPSOCKET_HANDLE*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: undefined reference to QDebug::~QDebug()'
                cmUdp.o:/home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: more undefined references to `QDebug::~QDebug()' follow
                collect2: error: ld returned 1 exit status
                make: *** [cppunittest_gui] Error 1
                11:06:25: The process "/usr/bin/make" exited with code 2.
                Error while building/deploying project cppunittest_gui (kit: Desktop Qt 5.5.1 GCC 64bit)
                When executing step "Make"
                11:06:25: Elapsed time: 00:16.

                Thanks and Regards
                Ayush

                kshegunovK 1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  The linking information is missing. That's needed in order to see whether the correct version of Qt is linked to your application.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    eureka
                    wrote on last edited by
                    #14

                    I'm still at beginner's crawling stage ..
                    but I do spot a space in your path .. /QT Projects/
                    I've learned to purge all spaces in my projects under development .. e.g. /Qt_Projects/
                    May not be relevant to your problem but worth remembering.

                    A 1 Reply Last reply
                    0
                    • A ayush_mistral

                      @kshegunov

                      Hi,

                      I tried to link the cppunit library dynamically but still getting the same error as follows

                      cmUdp.o: In function cCmUdp::cmUdpSocketInit(CM_UDPSOCKET_HANDLE*, HA_UDP_PARAM*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()'
                      /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()' cmUdp.o: In function cCmUdp::cmUdpSocketRead(CM_UDPSOCKET_HANDLE*, char*, unsigned int)':
                      /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()' /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()'
                      cmUdp.o: In function cCmUdp::cmUdpSocketClose(CM_UDPSOCKET_HANDLE*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: undefined reference to QDebug::~QDebug()'
                      cmUdp.o:/home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: more undefined references to `QDebug::~QDebug()' follow
                      collect2: error: ld returned 1 exit status
                      make: *** [cppunittest_gui] Error 1
                      11:03:37: The process "/usr/bin/make" exited with code 2.
                      Error while building/deploying project cppunittest_gui (kit: Desktop Qt 5.5.1 GCC 64bit)
                      When executing step "Make"
                      11:03:37: Elapsed time: 00:16.

                      When I include the cppunit as a static library I am getting the output as follows

                      cmUdp.o: In function cCmUdp::cmUdpSocketInit(CM_UDPSOCKET_HANDLE*, HA_UDP_PARAM*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()'
                      /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()' cmUdp.o: In function cCmUdp::cmUdpSocketRead(CM_UDPSOCKET_HANDLE*, char*, unsigned int)':
                      /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()' /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()'
                      cmUdp.o: In function cCmUdp::cmUdpSocketClose(CM_UDPSOCKET_HANDLE*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: undefined reference to QDebug::~QDebug()'
                      cmUdp.o:/home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: more undefined references to `QDebug::~QDebug()' follow
                      collect2: error: ld returned 1 exit status
                      make: *** [cppunittest_gui] Error 1
                      11:06:25: The process "/usr/bin/make" exited with code 2.
                      Error while building/deploying project cppunittest_gui (kit: Desktop Qt 5.5.1 GCC 64bit)
                      When executing step "Make"
                      11:06:25: Elapsed time: 00:16.

                      Thanks and Regards
                      Ayush

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

                      @ayush_mistral
                      Hello,
                      Getting the same error would mean that your problem shouldn't be related to the library itself, however I second @SGaist's note, you've not provided the linking step, only the errors. I'd suggest finding where the linker runs and allow for us to see what's done at that particular point.

                      Kind regards.

                      Read and abide by the Qt Code of Conduct

                      A 1 Reply Last reply
                      0
                      • kshegunovK kshegunov

                        @ayush_mistral
                        Hello,
                        Getting the same error would mean that your problem shouldn't be related to the library itself, however I second @SGaist's note, you've not provided the linking step, only the errors. I'd suggest finding where the linker runs and allow for us to see what's done at that particular point.

                        Kind regards.

                        A Offline
                        A Offline
                        ayush_mistral
                        wrote on last edited by
                        #16

                        @kshegunov

                        Hi,

                        Regarding the version , I am using version 5.5.1 of Qt and cpp unit version is 1.12.1
                        Regarding the linking step please find the complete compiler output as mentioned below.

                        11:16:28: Running steps for project cppunittest_gui...
                        11:16:28: Starting: "/usr/bin/make" clean
                        rm -f moc_mainwindow.cpp moc_cmTcp.cpp moc_cmUdp.cpp moc_simserver.cpp
                        rm -f ui_mainwindow.h
                        rm -f main.o mainwindow.o cmTcp.o cmUdp.o CommunicationModule.o CommunicationModuleTest.o CmTcpTest.o CmUdpTest.o simserver.o moc_mainwindow.o moc_cmTcp.o moc_cmUdp.o moc_simserver.o
                        rm -f ~ core .core
                        11:16:28: The process "/usr/bin/make" exited normally.
                        11:16:28: Configuration unchanged, skipping qmake step.
                        11:16:28: Starting: "/usr/bin/make"
                        /home/mistral/Qt/5.5/gcc_64/bin/uic mainwindow.ui -o ui_mainwindow.h
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o main.o main.cpp
                        main.cpp: In function 'int main(int, char
                        )':
                        main.cpp:18:20: warning: ignoring return value of 'int testing::UnitTest::Run()', declared with attribute warn_unused_result [-Wunused-result]
                        RUN_ALL_TESTS();
                        ^
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o mainwindow.o mainwindow.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o cmTcp.o cmTcp.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o cmUdp.o cmUdp.cpp
                        cmUdp.cpp: In member function 'CM_EN_RETURN cCmUdp::cmUdpSocketWrite(CM_UDPSOCKET_HANDLE*, SINT8*, quint32)':
                        cmUdp.cpp:195:12: warning: variable 's32BytesRead' set but not used [-Wunused-but-set-variable]
                        qint32 s32BytesRead;
                        ^
                        cmUdp.cpp:219:60: warning: 'ps8RecvBuffer' may be used uninitialized in this function [-Wmaybe-uninitialized]
                        &clientPort);
                        ^
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o CommunicationModule.o CommunicationModule.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o CommunicationModuleTest.o CommunicationModuleTest.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o CmTcpTest.o CmTcpTest.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o CmUdpTest.o CmUdpTest.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o simserver.o simserver.cpp
                        /home/mistral/Qt/5.5/gcc_64/bin/moc -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I/home/mistral/Qt/5.5/gcc_64/mkspecs/linux-g++ -I'/home/mistral/Desktop/QT Projects/cppunittest_gui' -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I/home/mistral/Qt/5.5/gcc_64/include -I/home/mistral/Qt/5.5/gcc_64/include/QtWidgets -I/home/mistral/Qt/5.5/gcc_64/include/QtGui -I/home/mistral/Qt/5.5/gcc_64/include/QtNetwork -I/home/mistral/Qt/5.5/gcc_64/include/QtCore mainwindow.h -o moc_mainwindow.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o moc_mainwindow.o moc_mainwindow.cpp
                        /home/mistral/Qt/5.5/gcc_64/bin/moc -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I/home/mistral/Qt/5.5/gcc_64/mkspecs/linux-g++ -I'/home/mistral/Desktop/QT Projects/cppunittest_gui' -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I/home/mistral/Qt/5.5/gcc_64/include -I/home/mistral/Qt/5.5/gcc_64/include/QtWidgets -I/home/mistral/Qt/5.5/gcc_64/include/QtGui -I/home/mistral/Qt/5.5/gcc_64/include/QtNetwork -I/home/mistral/Qt/5.5/gcc_64/include/QtCore cmTcp.h -o moc_cmTcp.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o moc_cmTcp.o moc_cmTcp.cpp
                        /home/mistral/Qt/5.5/gcc_64/bin/moc -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I/home/mistral/Qt/5.5/gcc_64/mkspecs/linux-g++ -I'/home/mistral/Desktop/QT Projects/cppunittest_gui' -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I/home/mistral/Qt/5.5/gcc_64/include -I/home/mistral/Qt/5.5/gcc_64/include/QtWidgets -I/home/mistral/Qt/5.5/gcc_64/include/QtGui -I/home/mistral/Qt/5.5/gcc_64/include/QtNetwork -I/home/mistral/Qt/5.5/gcc_64/include/QtCore cmUdp.h -o moc_cmUdp.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o moc_cmUdp.o moc_cmUdp.cpp
                        /home/mistral/Qt/5.5/gcc_64/bin/moc -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I/home/mistral/Qt/5.5/gcc_64/mkspecs/linux-g++ -I'/home/mistral/Desktop/QT Projects/cppunittest_gui' -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I/home/mistral/Qt/5.5/gcc_64/include -I/home/mistral/Qt/5.5/gcc_64/include/QtWidgets -I/home/mistral/Qt/5.5/gcc_64/include/QtGui -I/home/mistral/Qt/5.5/gcc_64/include/QtNetwork -I/home/mistral/Qt/5.5/gcc_64/include/QtCore simserver.h -o moc_simserver.cpp
                        g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I/usr/include/gtest -I/usr/include/cppunit -I/usr/include/cppunit -I../../../Qt/5.5/gcc_64/include -I../../../Qt/5.5/gcc_64/include/QtWidgets -I../../../Qt/5.5/gcc_64/include/QtGui -I../../../Qt/5.5/gcc_64/include/QtNetwork -I../../../Qt/5.5/gcc_64/include/QtCore -I. -I. -I../../../Qt/5.5/gcc_64/mkspecs/linux-g++ -o moc_simserver.o moc_simserver.cpp
                        g++ -Wl,-rpath,/home/mistral/Qt/5.5/gcc_64 -Wl,-rpath,/home/mistral/Qt/5.5/gcc_64/lib -o cppunittest_gui main.o mainwindow.o cmTcp.o cmUdp.o CommunicationModule.o CommunicationModuleTest.o CmTcpTest.o CmUdpTest.o simserver.o moc_mainwindow.o moc_cmTcp.o moc_cmUdp.o moc_simserver.o -L/home/mistral/Desktop/QT\ Projects/cppunittest_gui/../../../../../usr/lib/ -lgtest -L/home/mistral/Desktop/QT\ Projects/cppunittest_gui/../../../../../usr/lib/x86_64-linux-gnu/ -lcppunit -L/home/mistral/Qt/5.5/gcc_64/lib -lQt5Widgets -L/usr/X11R6/lib64 -L/usr/lib/x86_64-linux-gnu -lQt5Gui -lQt5Network -lQt5Core -lGL -lpthread
                        cmUdp.o: In function cCmUdp::cmUdpSocketInit(CM_UDPSOCKET_HANDLE*, HA_UDP_PARAM*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()'
                        /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:73: undefined reference to QDebug::~QDebug()' cmUdp.o: In function cCmUdp::cmUdpSocketRead(CM_UDPSOCKET_HANDLE*, char*, unsigned int)':
                        /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()' /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:128: undefined reference to QDebug::~QDebug()'
                        cmUdp.o: In function cCmUdp::cmUdpSocketClose(CM_UDPSOCKET_HANDLE*)': /home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: undefined reference to QDebug::~QDebug()'
                        cmUdp.o:/home/mistral/Desktop/QT Projects/cppunittest_gui/cmUdp.cpp:279: more undefined references to `QDebug::~QDebug()' follow
                        collect2: error: ld returned 1 exit status
                        make: *** [cppunittest_gui] Error 1
                        11:16:45: The process "/usr/bin/make" exited with code 2.
                        Error while building/deploying project cppunittest_gui (kit: Desktop Qt 5.5.1 GCC 64bit)
                        When executing step "Make"
                        11:16:45: Elapsed time: 00:16.

                        Thanks
                        Ayush

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

                          @ayush_mistral
                          At a first glance it looks okay, maybe @SGaist will spot something suspicious, I don't see anything out of the ordinary. What do you have here cmUdp.cpp:73 in your source (+- a couple of lines)? In principle the linker shouldn't be complaining about the destructor. Where does your Qt come from, have you built it yourself or you've installed it from the Qt site? Are you sure the compiler/linker used for building Qt matches the one you're using (although it seem you are)?

                          Kind regards.

                          Read and abide by the Qt Code of Conduct

                          A A 2 Replies Last reply
                          0
                          • kshegunovK kshegunov

                            @ayush_mistral
                            At a first glance it looks okay, maybe @SGaist will spot something suspicious, I don't see anything out of the ordinary. What do you have here cmUdp.cpp:73 in your source (+- a couple of lines)? In principle the linker shouldn't be complaining about the destructor. Where does your Qt come from, have you built it yourself or you've installed it from the Qt site? Are you sure the compiler/linker used for building Qt matches the one you're using (although it seem you are)?

                            Kind regards.

                            A Offline
                            A Offline
                            ayush_mistral
                            wrote on last edited by
                            #18

                            @kshegunov

                            Hi,

                            I download the QT version for linux from the Qt website only and for compiling and building my application I am using Qt creator IDE.

                            Thanks and Regards
                            Ayush

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #19

                              Did you also installed Qt from your distribution ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              A A 2 Replies Last reply
                              0
                              • kshegunovK kshegunov

                                @ayush_mistral
                                At a first glance it looks okay, maybe @SGaist will spot something suspicious, I don't see anything out of the ordinary. What do you have here cmUdp.cpp:73 in your source (+- a couple of lines)? In principle the linker shouldn't be complaining about the destructor. Where does your Qt come from, have you built it yourself or you've installed it from the Qt site? Are you sure the compiler/linker used for building Qt matches the one you're using (although it seem you are)?

                                Kind regards.

                                A Offline
                                A Offline
                                asanka424
                                wrote on last edited by
                                #20

                                @kshegunov you are linking with wrong libraries. You might have installed Qt from your package manager. So its linking with your program since linker is finding that before the actual libraries. If you are using Qt Creator go to projects tab and chanch path variable. Or uninstall Qt installed using your package manager

                                A 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  Did you also installed Qt from your distribution ?

                                  A Offline
                                  A Offline
                                  asanka424
                                  wrote on last edited by
                                  #21

                                  @SGaist just saw your post. I am thinking the same

                                  1 Reply Last reply
                                  0
                                  • E eureka

                                    I'm still at beginner's crawling stage ..
                                    but I do spot a space in your path .. /QT Projects/
                                    I've learned to purge all spaces in my projects under development .. e.g. /Qt_Projects/
                                    May not be relevant to your problem but worth remembering.

                                    A Offline
                                    A Offline
                                    ayush_mistral
                                    wrote on last edited by
                                    #22

                                    @eureka

                                    Thanks for observing I will definitely take care of this in future.

                                    Regards
                                    Ayush

                                    1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      Did you also installed Qt from your distribution ?

                                      A Offline
                                      A Offline
                                      ayush_mistral
                                      wrote on last edited by
                                      #23

                                      @SGaist

                                      I am not getting clearly. I download my qt set up from qt website and use the same script for installation.

                                      Thanks and Regards
                                      Ayush

                                      1 Reply Last reply
                                      0
                                      • A asanka424

                                        @kshegunov you are linking with wrong libraries. You might have installed Qt from your package manager. So its linking with your program since linker is finding that before the actual libraries. If you are using Qt Creator go to projects tab and chanch path variable. Or uninstall Qt installed using your package manager

                                        A Offline
                                        A Offline
                                        ayush_mistral
                                        wrote on last edited by
                                        #24

                                        @asanka424

                                        Hi,

                                        I didn't install QT from package manager but ran the executable from the set up which I obtained/downloaded from the QT website.

                                        Secondly I am also using Google test framework for testing my project but that is not causing any problem.
                                        I want to know why including cpp unit library and headers in the .pro file is causing the linking error?

                                        1 Reply Last reply
                                        0
                                        • A Offline
                                          A Offline
                                          asanka424
                                          wrote on last edited by
                                          #25

                                          Could you check if you have libQt5*.so in any other place than /home/mistral/Qt/5.5/gcc_64/lib

                                          A 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