Build qtcreator compilation environment under UOS system


foreword

This article records how to install qtcreator under the UOS system and the installation of the dependent packages involved. At the same time, it focuses on solving the problem that qtcreator prompts No valid kits found when adding a project.


1. Dependency package description

Directly give the installation package involved in installing qtcreator under the UOS system

sudo apt-get install qt5-default qt5-qmake g++ qtcreator #安装qtcreator工具以及g++编译器,qmake等
sudo apt-get install cmake #使用cmake编译,如果不是可以不安装

sudo apt install qtdeclarative5-dev #解决Qt versions中提示qmlscene未安装的
sudo apt-get install build-essential  #编译c/c++所需要的软件包

2. No valid kits found phenomenon

After opening qtcreator, creating a Qt Widgets or Qt Quick project will prompt No valid kits found , and cannot continue to operate.
insert image description here
The root cause of this problem is that qtcreator does not automatically recognize the Qt sdk, and you need to set the qmake path in Qt Versions .

At present, when we click "options", we will jump to the following interface. The following interface appears under the Qt Versions option, and we need to add it manually.
insert image description here
Now continue to look down.

3. No valid kits found problem solving

Premise: The qmake command needs to be correctly identified, the installation method:

sudo apt-get install qt5-qmake
或者
sudo apt-get install qt5-default

1. Find the qt installation path

We qmake --versioncan roughly see that the path of qt5 installation is /usr/lib/x86_64-linux-gnu through the command.

insert image description here
In the /usr/lib/x86_64-linux-gnu directory, we found that there is a qt5 directory. When we enter the /usr/lib/x86_64-linux-gnu/qt5/bin directory, there is information about qt, including
qmake , this is the directory location that needs to be set in Qt Versions.
insert image description here

2. Set Qt Versions

Click the "Add" button in "Qt Versions" and select the file as "/usr/lib/x86_64-linux-gnu/qt5/bin/qmake"

insert image description here
Click to open and the following interface will appear:
insert image description here

Here it prompts " qmlscene is not installed ", the solution is as follows:

sudo apt install qtdeclarative5-dev

After completing this instruction, be sure to restart qtcreator and then return to the kits setting interface again.

Shortcut method:
Tools -> Options (o)... -> Qt Versions, the correct interface at this time is as follows:
insert image description here

3. Select the Qt version under the build kit (kit)

We found that after completing the "Qt Versions" setting, the Kit still cannot be added. The reason at this time is that the "Qt Version" is selected as "None" under the current setting. As follows
insert image description here

Special Note: By default, the window is not maximized, you can choose to double-click the title where the "Options" is located to maximize or find the Qt version setting item through the scroll bar .

When we choose the correct qt version, we can add the kit normally.
insert image description here

4. Add the project again

When we create the project again, the following interface will appear:
insert image description here

This problem is all solved.

Guess you like

Origin blog.csdn.net/xiao3404/article/details/131365928
Recommended