Solved Bulding / adding subprojects ??
-
@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 ??
-
Just short add
-
I have successfully added plain C++ class to main project
-
The new cpp and h files are nowhere to be found in "projects" view
-
I can no longer add "New.." to main project - no such option...
-
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) -
I can still add New Subproject.
I am not a happy camper and RTFM no longer helps..
-
-
@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
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. -
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.
-
Here is a clean new " C_Project " "looking for executable "
No executable specified.
Which is "executable" ?
Help me solve that first.
-
Remove the "TEMPLATE = subdirs". You're overwriting the original value.
-
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 fileWHAT is missing ?
WHY and HOW to fix it ? -
@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.
-
@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 .
-
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.
-
@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 :
- New File or Project -> Other Project ->Subdirs Project
then use - 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
-
code / debug each added sub project as you would any other SINGLE project.
-
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. - New File or Project -> Other Project ->Subdirs Project
-
@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..