Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QT Project Build Issue

    General and Desktop
    2
    7
    1886
    Loading More Posts
    • 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
      ayush_mistral last edited by ayush_mistral

      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 Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • A
          ayush_mistral @jsulm last edited by

          @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 Reply Quote 0
          • A
            ayush_mistral @jsulm last edited by

            @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 Reply Quote 0
            • A
              ayush_mistral @jsulm last edited by

              @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 Reply Quote 0
              • jsulm
                jsulm Lifetime Qt Champion last edited by

                Did you try to rebuild your project completely?

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

                A 1 Reply Last reply Reply Quote 0
                • A
                  ayush_mistral @jsulm last edited by

                  @jsulm

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

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post