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. QT Project Build Issue
Forum Updated to NodeBB v4.3 + New Features

QT Project Build Issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 2.2k 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.
  • A Offline
    A Offline
    ayush_mistral
    wrote on 12 Jan 2016, 06:50 last edited by ayush_mistral 1 Dec 2016, 06:51
    #1

    Hi,

    I added cppunit testing framework to test a QT GUI Application. After Adding application project is not building. It is showing undefined errors for Qt components like Qdebug, QPainter etc. If I remove cppunit testing library and Cppunit Macros for testing in the source code of the project, it is building and running fine. Please tell me if anyone has any idea about this issue.

    Thanks in advance
    Ayush

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 12 Jan 2016, 07:34 last edited by
      #2

      You should provide more information: how did you add cppunit library, what did you change, what are the error messages exactly.
      Can you post your PRO file?

      Qt provides a test framework: http://doc.qt.io/qt-5/qtest-overview.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 3 Replies Last reply 12 Jan 2016, 08:06
      0
      • J jsulm
        12 Jan 2016, 07:34

        You should provide more information: how did you add cppunit library, what did you change, what are the error messages exactly.
        Can you post your PRO file?

        Qt provides a test framework: http://doc.qt.io/qt-5/qtest-overview.html

        A Offline
        A Offline
        ayush_mistral
        wrote on 12 Jan 2016, 08:06 last edited by
        #3

        @jsulm
        I added the cpp unit library with add external library wizard of the QT creater, provide the library path and include path of the headers.

        I added the CppUnit Macros in the source code to test one of the methods of class like this
        class sampletest : public CppUnit ::TestCase
        {
        CPPUNIT_TEST_SUITE(sampletest);
        CPPUNIT_TEST(zerotest);
        CPPUNIT_TEST(nonzerotest);
        CPPUNIT_TEST_SUITE_END();

        public:
        void zerotest();
        void nonzerotest ();
        };

        void sampletest :: zerotest()
        {
        MfcCoreConfig mysample;
        CPPUNIT_ASSERT_MESSAGE ("Test Failed", mysample.validateThresholdValue(11.01f) == MAX_MFC_THRESHOLD);

        }

        void sampletest :: nonzerotest()
        {
        MfcCoreConfig mysample;
        CPPUNIT_ASSERT_MESSAGE ("Test Not Passed", mysample.validateThresholdValue(100.01f) == MAX_MFC_THRESHOLD);
        }

        1 Reply Last reply
        0
        • J jsulm
          12 Jan 2016, 07:34

          You should provide more information: how did you add cppunit library, what did you change, what are the error messages exactly.
          Can you post your PRO file?

          Qt provides a test framework: http://doc.qt.io/qt-5/qtest-overview.html

          A Offline
          A Offline
          ayush_mistral
          wrote on 12 Jan 2016, 08:13 last edited by
          #4

          @jsulm

          My pro file is this

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

          Project created by QtCreator 2013-07-22T11:37:35

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

          QT += core gui

          QT += network

          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

          TARGET = MFC_Client_App
          TEMPLATE = app

          SOURCES += main.cpp
          mfcclientapp.cpp
          qcustomplot.cpp
          mfcmdiwidget.cpp
          clientsocket.cpp
          MAINCore.cpp
          MfcUIconfiguration.cpp
          MfcCoreConfig.cpp
          sampletest.cpp

          HEADERS += mfcclientapp.h
          qcustomplot.h
          mfcmdiwidget.h
          clientsocket.h
          MAINCore.h
          mistTypes.h
          Packet.h
          MfcCoreConfig.h
          packet.h
          sampletest.h

          FORMS += mfcclientapp.ui

          RESOURCES +=
          resource.qrc

          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

          1 Reply Last reply
          0
          • J jsulm
            12 Jan 2016, 07:34

            You should provide more information: how did you add cppunit library, what did you change, what are the error messages exactly.
            Can you post your PRO file?

            Qt provides a test framework: http://doc.qt.io/qt-5/qtest-overview.html

            A Offline
            A Offline
            ayush_mistral
            wrote on 12 Jan 2016, 08:18 last edited by
            #5

            @jsulm

            The error message log is this

            Desktop/QT Projects/MFC_Client_App/qcustomplot.cpp:772: error: undefined reference to `QDebug::~QDebug()'

            /Qt/5.5/gcc_64/include/QtCore/qdebug.h:201: error: undefined reference to `QDebug::~QDebug()'

            Qt/5.5/gcc_64/include/QtCore/qmetatype.h:1680: error: undefined reference to `QMetaType::registerNormalizedType(QByteArray const&, void ()(void), void* ()(void, void const*), int, QFlagsQMetaType::TypeFlag, QMetaObject const*)'

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 12 Jan 2016, 08:45 last edited by
              #6

              Did you try to rebuild your project completely?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply 12 Jan 2016, 08:55
              0
              • J jsulm
                12 Jan 2016, 08:45

                Did you try to rebuild your project completely?

                A Offline
                A Offline
                ayush_mistral
                wrote on 12 Jan 2016, 08:55 last edited by
                #7

                @jsulm

                Yes i tried clean and rebuild but same errors it is showing

                1 Reply Last reply
                0

                1/7

                12 Jan 2016, 06:50

                • Login

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