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. SubDirs Project Widget not found on compilation
Forum Updated to NodeBB v4.3 + New Features

SubDirs Project Widget not found on compilation

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 341 Views 2 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.
  • S Offline
    S Offline
    sandro4912
    wrote on last edited by
    #1

    I try to convert a project into a subdirs project to add unit tests.

    My structure looks like this:

    dc24595e-17c3-4ae4-be77-c52ccb52ac82-image.png

    The minefield-src.pri looks like this:

    SOURCES += \
        ../src/besttimesdialog.cpp \
        ../src/cell.cpp \
        ../src/cellinputhandler.cpp \
        ../src/converttograyscale.cpp \
        ../src/customfielddialog.cpp \
        ../src/game.cpp \
        ../src/gamesettings.cpp \
        ../src/lcddisplay.cpp \
        ../src/mainwindow.cpp \
        ../src/minefield.cpp \
        ../src/smileypushbutton.cpp \
        ../src/windialog.cpp
    
    HEADERS += \
        ../src/besttimesdialog.h \
        ../src/cell.h \
        ../src/cellinputhandler.h \
        ../src/converttograyscale.h \
        ../src/customfielddialog.h \
        ../src/game.h \
        ../src/gamesettings.h \
        ../src/lcddisplay.h \
        ../src/mainwindow.h \
        ../src/minefield.h \
        ../src/smileypushbutton.h \
        ../src/windialog.h
    
    
    FORMS += \
        ../src/besttimesdialog.ui \
        ../src/customfielddialog.ui \
        ../src/windialog.ui
    
     RESOURCES += \
        ../src/minesweeper.qrc
    

    The minefield.pro:

    TEMPLATE = subdirs
    
    SUBDIRS += \
        src \
        tests
    
    OTHER_FILES = minefield-src.pri
    

    The src.pro:

    QT += widgets
    CONFIG += c++17
    
    TARGET = src
    TEMPLATE = app
    
    include(../minefield-src.pri)
    
    SOURCES += main.cpp
    

    The tests.pro:

    QT += testlib
    QT += gui
    CONFIG += C++17 console
    
    TEMPLATE = app
    
    include (../minefield-src.pri)
    
    APP_PATH = ../src
    INCLUDEPATH += $$APP_PATH
    DEPENDPATH += $$APP_PATH
    
    

    First of all i see all the source files from the pri which should be a good sign.

    But when i compile i get errors like this:

    ef089e8d-0ea3-41d6-bada-4ca24a79b670-image.png

    d1983cff-faf0-44ce-b74a-e7f9424286f5-image.png

    I wonder whats the Issue here? `widgets``is set in the pro files of the subprojects.

    The code successfully compiled before before I rearranged to have the project in a subdirs project with a test project

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

      Hi,

      You are missing

      QT += widgets
      

      In your test .pro file.

      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
      3
      • S Offline
        S Offline
        sandro4912
        wrote on last edited by
        #3

        After adding it the error is solved. However now I get this Issue:

        6ef64b94-18d5-4b96-8567-8d6eacb10015-image.png

        //...
        #include <algorithm>
        
        
        //...
        
        
        void LcdDisplay::setDisplayValue(int value)
        {
            constexpr auto minDisplayValue = -99;
            constexpr auto maxDisplayValue = 999;
        
            mValue = std::clamp(value, minDisplayValue, maxDisplayValue);
        
        //...
        

        This is very weired. If you look at the post above i say in both the pro files c++17. So whats the issue here?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          As you can see there is no compiler flag to use c++17 so your config line is wrong - I would guess it's 'c++17', not 'C++17'.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          3
          • S Offline
            S Offline
            sandro4912
            wrote on last edited by
            #5

            you are right sometime you don't see the forest because there are to many trees ;/

            Pablo J. RoginaP 1 Reply Last reply
            1
            • S sandro4912

              you are right sometime you don't see the forest because there are to many trees ;/

              Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by
              #6

              @sandro4912 is your issue solved? if so please don't forget to mark your post as such! Thanks

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              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