Default project fails
-
@jimbrownqtuser
P.S.
One thought. It would not apply if things go wrong solely on one machine, but might if you are trying to move projects between Qts. Don't forget that Creator offers two different build systems. At Qt5 the default was qmake (uses.pro
file) but at Qt6 the default was moved to cmake (usesCMakeLists
file). If using cmake you won't be able to read a.pro
file as a project..... -
I appreciate your willingness to help. I described some experiments that I did to try to understand what's going on and I see that confused the issue.
I'll try to answer all the questions but first I have a simple reproducible case that is only on Ubuntu 24.04 and doesn't involve any file not provided by the system.
- The simple case
I did a minimal install of Ubuntu 24.04.
Make sure it's up to date
apt update apt upgrade
Install Qt stuff
apt-get -y install qtbase5-dev qt5-qmake apt-get -y install qtchooser apt-get -y install qtcreator
Check that Qt is installed
.../jimbrown:qtchooser -list-versions 4 5 default qt4-x86_64-linux-gnu qt4 qt5-x86_64-linux-gnu qt5
See where headers are located
.../jimbrown:qmake -query QT_INSTALL_HEADERS /usr/include/x86_64-linux-gnu/qt5
Make sure qmake is available
.../jimbrown:find /usr/lib -name qmake /usr/lib/qt5/bin/qmake /usr/lib/x86_64-linux-gnu/qt5/bin/qmake
I notice no qmake for qt4 but I don't think it matters.
reboot the system
Run QT Creator
Create project by pressing "Create Project" green button.
Application (Qt) / Qt Widgets Application / Choose
Name: ttt in /home/jimbrown
Next - Build system: qmake
Next / Next / Next/ NextIt shows that files will be added
Press "Finish"
This shows that although it says there is a project named ttt and a file ttt.pro, there are no Headers, Source or Forms. It also says "This file is not part of any project. ..."
That's the failure.
The files it says it would create are created:
~/ttt:ls main.cpp mainwindow.cpp mainwindow.h mainwindow.ui ttt.pro ttt.pro.user
That's the end of the case.
- Questions that you asked or additional comments.
If I move the ttt directory and it's content to an earlier version of Ubuntu, Qt Creator recognizes the project correctly and can build and run it.
Thanks for explaining that a Qt6 Creator could build a Qt5 application or vice versa. I wanted to eliminate that as a possible source of the problem.
You asked "How did you create a correct project under 24.04 in the first place if it's not recognized as a valid project?"
As I explained above, the project is created correctly. But Creator does not appear to recognize it. So on 24.04, I cannot build an executable program. On earlier versions of Ubuntu, those same files work.
Qt Creator is version 13.0.0
I do want to use Qt5 because I'm hoping to get a paying job early next year with a company that uses Qt5. They are currently on Ubuntu 20.04 but I expect them to move to a newer version and I want to be ready.
Thanks again for your help.
-
@jimbrownqtuser said in Default project fails:
The files it says it would create are created:
Hi, show the content of yourttt.pro
file please.
Ah nvm, it is posted above already :D
It doesn't look wrong...Are you able to create CMake projects with QtCreator? Do they show a proper structure in QtCreator?
-
I tried making the default app with cmake. Same result "This file is not part of any project. ..."
-
@jimbrownqtuser said in Default project fails:
You asked "How did you create a correct project under 24.04 in the first place if it's not recognized as a valid project?"
As I explained above, the project is created correctly. But Creator does not appear to recognize it. So on 24.04, I cannot build an executable program. On earlier versions of Ubuntu, those same files work.
You are now very clear about what you see. Creator lets you create a project, creates the
.pro
and source files, yet does not recognise it as a project. I have not seen this before so I don't know. Check it has found proper Kits?Like I said, I have Qt6 installed same way under 24.04 and that's fine. I don't know if the problem is because you are using Qt5 or whether that is not relevant.
-
Checking kits is a good idea. I'm not sure what to check for. HERE'S WHAT i see:
-
I can't reproduce it but looking at the kits I got a pop-up like you would get with mouse button 2 and it said under compiler - clang. Certainly not what I want. I don't understand kits and don't know what to do. But it's a lead. Thanks
-
@jimbrownqtuser said in Default project fails:
I don't understand kits
A kit is the set of tools you use to develop/build your app within QtCreator. It contains compiler, debugger and run/build settings.
It's weird to see this empty... So QtCreator does not seem to recognize your Qt installation
-
Solved!
The solution was to change the desktop kit so the C++ compiler was GCC instead of CLANG. The C compiler was already set to GCC.
The default app now shows all the files, is recognized as a project and runs.
The suggestion "Check it has found proper Kits?" was the clue that led me to this solution. If I had more experience with Qt maybe I would have thought of that. I certainly didn't suspect that if you had a different compiler selected in the kit that the project display would not show Headers, Sources and Forms.
I read the documentation on kits and learned how to create and modify kits.
Thanks to those who helped. I would not have solved this without you.
-
@jimbrownqtuser said in Default project fails:
The solution was to change the desktop kit so the C++ compiler was GCC instead of CLANG.
Indeed! I can only say that my 24.04 installation (with Qt6) did this already, I never had a problem.
It's obviously not helpful that it creates a project yet then cannot handle it.