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. Bulding / adding subprojects ??
Forum Updated to NodeBB v4.3 + New Features

Bulding / adding subprojects ??

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 3 Posters 5.1k 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by Anonymous_Banned275
    #4

    As expected - it sounded too simple to work by just adding "include" .

    include (/home/d/CAT_MAIN/TEST_Application/TEST_Application.pro )

    1.I build two identical projects and "included" the subproject in main project.
    Obviously - Build main project complains of multiple definitions

    Now here are my options

    1. rename duplicate file
      did not help
    2. delete duplicate file
      now the subpropject is no longer full app and without main won't obviously compile by itslef.
      or ??
    • not so easy to fix.
    1. Minor changes in subproject do not trigger rebuild - looks as the safest way is to always "rebuild all; " - sort of expected

    2. I am adding new QtWIdget to sub-project - will be watching for smoke...

    Now the main project build reports this error:

    :-1: error: No rule to make target 'app_form.ui', needed by 'ui_app_form.h'. Stop.

    It looks that I need to try plain C++ class , no widget derived.

    Edit
    Same problem

    :-1: error: No rule to make target 'app_test_class.cpp', needed by 'app_test_class.o'. Stop.

    OK. so WHERE / HOW I instruct main project - what "rule" is missing and where?

    PS I did look at the link and it is way over my head , besides I do not want to get involved with "Windoze"

    So for now adding "include ( project) " to main project is bogus - not enough to make it work... not even a good solid start...

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Anonymous_Banned275
      wrote on last edited by Anonymous_Banned275
      #5

      here is what Mrs Google found

      https://www.programmersought.com/article/53875412403/

      time to RTFM

      Later

      OK, let me simplify things,
      AFTER adding the .pro file , using the above link, I get a NEW menu options
      when clicking on the "project "
      simple "Adding subproject..."

      My qustion to the forum
      "which option in the "multiprooject file" actually triggers thus option?

      And the answer is

      TEMPLATE = subdirs

      placed in main project . .pro file makes add new subproject a child's play

      • time to ditch
        "include (project file .pro) "

      BUT - there is always a BUT

      when BOTH main project and FIRST subproject have main window -
      the project will try execute and "show " both!
      Of course if BOTH have defunct placement only the subproject will actually be visible "on top" -. It can be moved...
      BUT where is the main project main window ?
      Nowhere because the process gets stuck running "standard" QApplication "llop" in first suboproject.

      The main question - how does main project let FIRST subproject to execute anyway ??

      What option / setting is missing ??

      Or is the only option to actually execute the sub projects ??
      That is NOT what I need - I need to "inlcude " the subprojects , not to run them individually.

      Maybe the "include(project) is needed after all...

      A 1 Reply Last reply
      0
      • A Anonymous_Banned275

        here is what Mrs Google found

        https://www.programmersought.com/article/53875412403/

        time to RTFM

        Later

        OK, let me simplify things,
        AFTER adding the .pro file , using the above link, I get a NEW menu options
        when clicking on the "project "
        simple "Adding subproject..."

        My qustion to the forum
        "which option in the "multiprooject file" actually triggers thus option?

        And the answer is

        TEMPLATE = subdirs

        placed in main project . .pro file makes add new subproject a child's play

        • time to ditch
          "include (project file .pro) "

        BUT - there is always a BUT

        when BOTH main project and FIRST subproject have main window -
        the project will try execute and "show " both!
        Of course if BOTH have defunct placement only the subproject will actually be visible "on top" -. It can be moved...
        BUT where is the main project main window ?
        Nowhere because the process gets stuck running "standard" QApplication "llop" in first suboproject.

        The main question - how does main project let FIRST subproject to execute anyway ??

        What option / setting is missing ??

        Or is the only option to actually execute the sub projects ??
        That is NOT what I need - I need to "inlcude " the subprojects , not to run them individually.

        Maybe the "include(project) is needed after all...

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #6

        @AnneRanch
        Allow me to rephrase the next question.

        Assuming the purpose of having project with subprojects is to "build a sub -project and when it works add it to the main project" .

        That , to me , means the sub project has to be build and run independently from the main project. To do so it has to have "main" like any other software.
        It does that.

        Hence when sub project is added via " New Subproject..." it does compile / build / run independently as desired.

        However, when main project is run it starts with "main window" then it runs "main window" of first sub project. Since subproject is build around / inside QApplication a(argc, argv); ( I do not know how else to call it ) THE PROCESS STOPS INSIDE QApplication loop of first sub project....
        The sub project does nothing but shows main window for now.

        I am assuming I am missing some instruction to "break" this chain and be able to incorporate sup project code into main project without actually running the sub projects.

        Or am I totally off in the left field ??

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #7

          Just short add

          1. I have successfully added plain C++ class to main project

          2. The new cpp and h files are nowhere to be found in "projects" view

          3. I can no longer add "New.." to main project - no such option...

          4. I can no longer add "New Subproject -> Files and Classes" - no data in view
            ( see #1 This is what I used to add now invisible C++ class to main project)

          5. I can still add New Subproject.

          I am not a happy camper and RTFM no longer helps..

          A 1 Reply Last reply
          0
          • A Anonymous_Banned275

            Just short add

            1. I have successfully added plain C++ class to main project

            2. The new cpp and h files are nowhere to be found in "projects" view

            3. I can no longer add "New.." to main project - no such option...

            4. I can no longer add "New Subproject -> Files and Classes" - no data in view
              ( see #1 This is what I used to add now invisible C++ class to main project)

            5. I can still add New Subproject.

            I am not a happy camper and RTFM no longer helps..

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

            @AnneRanch
            Sorry group , but this is turning into proverbial can of worms.
            Nothing works same each time it is used and seldom the way one expect.
            It looks as adding
            TEMPLATE = subdirs
            in .pro file takes hold after ALL builds are used - I mean "Build" "Run qmake" "Rebuild" - perhaps one of them does it.

            When running just the main project, without adding sub project, I get dialog asking to select executable.

            That would solve the issue I had executing real project with subprojects , but I have no idea WHAT is plain Qt project executable . No .exe - In linux ! How do I know / identify "linux project executable ?" The dialog does not present executable files only so it is up to me know which one it is.

            So _ I expect that there would be ONE executable WHEN there is only main project.

            Then I would expect to be ask to select the executable - main project _ when I add my my first sub project.

            The I get this

            637dac87-3da3-4fb4-b4df-c4194f82eee7-image.png

            OK, there is no executable - BUT how do I get back to the original annoying dialog which let me select one?

            See what I mean ?
            First I get request to select executablee when there is only one ( running main project without adding sub projects) , now I am told there is no executable without slightest hit HOW to add /select one...

            PS
            Note the funky TAB title.

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

              It seems you did not understand the concept behind the subdirs template.

              Each project that composes it is a complete project. It's not a way to structure your files for a single project.

              See for example this tutorial.

              If Qt Creator does not find any executable, then it means that none of your sub-project implements the app template.

              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
              1
              • SGaistS SGaist

                It seems you did not understand the concept behind the subdirs template.

                Each project that composes it is a complete project. It's not a way to structure your files for a single project.

                See for example this tutorial.

                If Qt Creator does not find any executable, then it means that none of your sub-project implements the app template.

                A Offline
                A Offline
                Anonymous_Banned275
                wrote on last edited by Anonymous_Banned275
                #10

                @SGaist

                Here is a clean new " C_Project " "looking for executable "

                bfe43c0d-4d59-40e4-81f6-1c2a2b21e724-image.png No executable specified.

                Which is "executable" ?

                5d20878a-c803-4177-8927-e259ac7110e6-image.png

                Help me solve that first.

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

                  Remove the "TEMPLATE = subdirs". You're overwriting the original value.

                  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 Offline
                    A Offline
                    Anonymous_Banned275
                    wrote on last edited by
                    #12

                    Here is normal" run , without the

                    TEMPLATE = subdirs

                    which enables "New subprogram..."

                    My interim conclusion
                    enabling "New subprogram " causes the "mising executable".
                    I must be missing something else in .pro file

                    WHAT is missing ?
                    WHY and HOW to fix it ?

                    4b06aada-03c6-408f-804a-4faf62350055-image.png

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

                      @AnneRanch said in Bulding / adding subprojects ??:

                      WHAT is missing ?

                      The understanding of how the subdirs template works.

                      @AnneRanch said in Bulding / adding subprojects ??:

                      WHY and HOW to fix it ?

                      For why: to make it work I guess.

                      For the how, I already provided a link to a tutorial that explains the concepts and one to a wiki page that also explains how it works.

                      So you should start by taking a step back, create a proper subdirs project from scratch and once your have it properly building and running, move back to your project.

                      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
                      2
                      • SGaistS SGaist

                        Remove the "TEMPLATE = subdirs". You're overwriting the original value.

                        A Offline
                        A Offline
                        Anonymous_Banned275
                        wrote on last edited by
                        #14

                        @SGaist
                        You are the man...
                        Sure , makes perfect sense - when app is replaced by subdirs all hell breaks loose.

                        So
                        TEMPLATE = app needs to be " reinstalled " , preferably in main project..

                        I'll go back to the first multi project which still somewhat works to see how
                        TEMPLATE = app was handled there.
                        There the problem was - the main "executable" somehow connected to the sub project "executable"....

                        This will take some time, but I;ll keep you posted .

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

                          First thing: you can't just replace the template type in your application .pro file.

                          The subdirs template requires a structure to be followed. As explained in the links I have posted.

                          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
                          1
                          • SGaistS SGaist

                            First thing: you can't just replace the template type in your application .pro file.

                            The subdirs template requires a structure to be followed. As explained in the links I have posted.

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

                            @SGaist said in Bulding / adding subprojects ??:

                            @AnneRanch said in Bulding / adding subprojects ??:

                            WHAT is missing ?

                            The understanding of how the subdirs template works.

                            Yes, looks as the whole concept of "subproject" is good for what I wanted - be able to load multiple projects .

                            The only weird issue is the the "main project" is actually one, preferably the first "subproject".
                            But it will do.

                            SOLVED / CORRECTION
                            The basic Qt "subproject" concept is to have multiple projects "under one roof".
                            Unfortunately some tutorials concentrate on expanding this simple, primarily administrative concept thus making the implementation far more complicated then it is .

                            When one follows these tutorials , as I did , the QtCreator implementation is completely covered and it leads to few dead ends.

                            Here is my conclusion:

                            Start with :

                            1. New File or Project -> Other Project ->Subdirs Project
                              then use
                            2. project -> "New Subproject..." and select desired project type

                            finally use
                            Run
                            3. and your newly added FIRST (sub) project will (build and ) execute.

                            repeat step 2 3 as necessary

                            1. code / debug each added sub project as you would any other SINGLE project.

                            2. Qt will build / rebuild every sub project as necessary.

                            Essentially all is needed is to know to implement this scheme

                            TEMPLATE is your friend

                            In closing I really appreciate all the help received from the discussion participants.

                            PS
                            Like to hear from anybody who successfully Imported existing sub project using the "new subproject... " options.

                            1 Reply Last reply
                            0
                            • NevezN Offline
                              NevezN Offline
                              Nevez
                              wrote on last edited by
                              #17

                              @AnneRanch
                              you are a great person. I searched many sites all day long. However, I was more confused about what to do. After reading and applying what in your last post, I've literally succeeded. Really thank you so much. Have a nice day..

                              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