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 test linking error
Forum Updated to NodeBB v4.3 + New Features

Qt test linking error

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 391 Views 3 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.
  • F Offline
    F Offline
    febinzcs
    wrote on last edited by
    #1

    Hey there, I've created a subdirs project with gui and test projects and I've added the SOURCES and HEADERS in test .pro file with INCLUDEPATH. When I'm trying to add 'homeScreen' class to test project, I'm getting linking errors that ui memebers like labels are not found.

    ../../clockApp/clock-alarmApp/homescreen.cpp: In member function 'void homeNameSpace::homeScreen::timeUpdateSlot()':
    ../../clockApp/clock-alarmApp/homescreen.cpp:46:9: error: 'class Ui::homeScreen' has no member named 'mainTimeLabel'
    

    the homeNameSpace includes the homeScreen class definition in the homeScreen.h file

    The test pro file:

    QT += gui core widgets
    
    CONFIG += qt warn_on depend_includepath testcase
    
    TEMPLATE = app
    
    INCLUDEPATH += ../clock-alarmApp
    SOURCES +=  tst_loadingtest.cpp \
        ../clock-alarmApp/homescreen.cpp \
        ../clock-alarmApp/splashscreen.cpp
    
    HEADERS += \
        ../clock-alarmApp/homescreen.h \
        ../clock-alarmApp/splashscreen.h
    
    RESOURCES += \
        ../clock-alarmApp/resources.qrc
    
    sierdzioS 1 Reply Last reply
    0
    • F febinzcs

      Hey there, I've created a subdirs project with gui and test projects and I've added the SOURCES and HEADERS in test .pro file with INCLUDEPATH. When I'm trying to add 'homeScreen' class to test project, I'm getting linking errors that ui memebers like labels are not found.

      ../../clockApp/clock-alarmApp/homescreen.cpp: In member function 'void homeNameSpace::homeScreen::timeUpdateSlot()':
      ../../clockApp/clock-alarmApp/homescreen.cpp:46:9: error: 'class Ui::homeScreen' has no member named 'mainTimeLabel'
      

      the homeNameSpace includes the homeScreen class definition in the homeScreen.h file

      The test pro file:

      QT += gui core widgets
      
      CONFIG += qt warn_on depend_includepath testcase
      
      TEMPLATE = app
      
      INCLUDEPATH += ../clock-alarmApp
      SOURCES +=  tst_loadingtest.cpp \
          ../clock-alarmApp/homescreen.cpp \
          ../clock-alarmApp/splashscreen.cpp
      
      HEADERS += \
          ../clock-alarmApp/homescreen.h \
          ../clock-alarmApp/splashscreen.h
      
      RESOURCES += \
          ../clock-alarmApp/resources.qrc
      
      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You need to add FORMS and point to your .ui file, too.

      (Z(:^

      F 1 Reply Last reply
      0
      • sierdzioS sierdzio

        You need to add FORMS and point to your .ui file, too.

        F Offline
        F Offline
        febinzcs
        wrote on last edited by
        #3

        @sierdzio Ok got it, thanks. Another doubt that I'm having is, do I need to generate seperate auto test projects, inorder to generate xml reports.
        And how to generate reports at end of each test.

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

          Hi,

          Use the SUBDIRS template and create one project per unit test you want to have.

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

          F 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Use the SUBDIRS template and create one project per unit test you want to have.

            F Offline
            F Offline
            febinzcs
            wrote on last edited by
            #5

            @SGaist @sierdzio thanks for the reply and appreciate your time.

            1 Reply Last reply
            0
            • F febinzcs has marked this topic as solved on

            • Login

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