Default project fails
-
Only .pro file in projects pane after creating default application on Ubuntu 24.04.
No other project files or source are shown. This message at top of edit pane:
Warning: This file is not part of any project.I'm using Qt 5.15.3
Here's how I tried to create project:
File / New Project
Applucation (Qt) / Qt Widgets Appication / Choose
Name: ttt in /home/jimbrown
Next - Build system: qmake
Next / Next / Next/ NextIt said:
Files to be added in
/home/jimbrown/ttt:main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
ttt.proFinish
The cpp h and ui files were created but aren't listed in the projects.
If I load a project built in Ubuntu 20.04 or 22.04 I get the same symptons
even if I delete the .user file.Here's how I installed Qt (I want to do it from the command line):
apt-get -y install build-essential openssl libssl-dev
libssl1.0 libgl1-mesa-dev libqt5x11extras5 '^libxcb.*-dev'
libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev
libxkbcommon-dev libxkbcommon-x11-devapt-get -y install qtbase5-dev qt5-qmake
apt-get -y install qtchooser
apt-get -y install qtcreatorThis worked in Ubuntu 20.04 and 22.04. In 24.04 lots of things missing
and I had to:
apt --fix-broken installI'm probably missing some package in Ubuntu 24.04.
After days of searching I found a recommendation to install these:
apt-get install libqt5quickcontrols2-5 libqt5multimedia5 libqt5webengine5 libqt5quick5 libqt5qml5Made no difference
Many thanks in advance.
-
@jimbrownqtuser
The one thing you have not shown is what ends up in the saved.pro
file?
And please use the forum's Code tags when you paste its contents. -
I want to be a good citizen but I don't know what you mean by " the forum's Code tags"
-
@jimbrownqtuser
Toolbar on "full reply" (not "Quick") has</>
icon.
```
(triple backtick) above & below code block.Put the file contents here.
-
Hope it's OK to include comments as well as code. The ttt.pro file is below and looks good to me. So I tar'd up the whole project and moved it it Ubuntu 22.04 and it worked. I ran it in debug mode and stepped through the code. I think this tells me that it is the installation of Qt Creator on Ubuntu 24.04 that is the problem. If I move samples from Ubuntu 22.04 to 24.04, they run OK but I can't open them in Qt Creator.
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++17 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
-
The project that I'm having a problem with is the default project that Qt Creator builds. I'm on Ubuntu 24.04 I run Qt Creator and create the default Application (Qt) / Qt Widgets Application project as I outlined in my original post. It's all the code and project files that Qt Creator constructed. Nothing of mine.
-
To be clear, Qt Creator on Ubuntu 24.04 creates a correct project which if moved to Ubuntu 22.04 runs and can be debugged with Qt Creator on that system. It is not recognized on the 24.04 system as a valid project with contents even though it was constructed there.
I expected entries for Headers, Source, and forms in the Creator project pane which you can see from the picture are not there.
I also expected a build-ttt-Desktop-Debug directory on my 24.04 machine but this directory was not created but since I can't run a build it's not surprising.
-
I'm using Qt5. Is it possible Qt Creator needs Qt6?
qtchooser -list-versions 4 5 default qt4-x86_64-linux-gnu qt4 qt5-x86_64-linux-gnu qt5
-
I reinstalled Ubuntu 24.04 from scratch and entered these two lines
apt-get -y install qtbase5-dev qt5-qmake apt-get -y install qtcreator
The project is created correctly but Qt Creator fails the same way.
-
@jimbrownqtuser
I am still not certain where you are at.Creator is built with some version of Qt, be that, say, Qt5 or Qt6. It comes with all the libraries it needs from that version inside the Creator executable area --- have a look where that is and you should find all its shared libraries there or nearby. So it is self-contained, and does not care/is independent from what version of Qt you have installed for building your projects with. They are customarily the same, but do not have to be, so a Qt6 Creator could build a Qt5 application or vice versa.
If I understand right, you create a project on one machine under one version of Ubuntu, you can build and run it. If you take the executable to a different machine with different version of Ubuntu it also runs. But if you take the
.pro
and sources they do not read in as a project in Creator on the other machine.Then again, I don't quite get
To be clear, Qt Creator on Ubuntu 24.04 creates a correct project which if moved to Ubuntu 22.04 runs and can be debugged with Qt Creator on that system. It is not recognized on the 24.04 system as a valid project with contents even though it was constructed there.
How did you create a correct project under 24.04 in the first place if it's not recognised as a valid project? I don't get that, it would have to be a valid project while you are interacting with Creator to create it?
FWIW, I also asked you earlier what versions of Creator you installed/created on the two systems but you did not reply. You can see from within Creator from the Help menu. I would not expect the versions of Creator fetched via
apt
under the differing versions of Ubuntu to be the same.Can't we eliminate any discussion of 24.04 and moving files between machines? Can you create a project from scratch (not by copying files) under 24.04 and it goes wrong? How do you succeed in adding files to this project in Creator to create it if at the same time you tell us that it doesn't create a project/show the files?
Are you wedded to Qt5? I can say that installing and using Qt6 under 24.04 works. I have not tried to install and run Qt5 under 24.04. Not to say it should not work, but it would be interesting to know whether that works instead.
-
@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.