为了检验QT开发环境今天创建了QT开发环境,这里记录一下,供大家借鉴:
1、安装qtcreator:
cat@lubancat:~$ sudo apt install qtcreator
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
--------此处省略
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
2、安装qttools5-dev-tools
cat@lubancat:~$ sudo apt install -y qttools5-dev-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
qttools5-dev-tools is already the newest version (5.15.3-1).
qttools5-dev-tools set to manually installed.
The following packages were automatically installed and are no longer required:
accountsservice-ubuntu-schemas activity-log-manager apg aptdaemon aptdaemon-data
3、安装一些必要的工具:
cat@lubancat:~$ sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
qtchooser is already the newest version (66-2build1).
qtchooser set to manually installed.
qtbase5-dev-tools is already the newest version (5.15.3+dfsg-2ubuntu0.2).
qtbase5-dev-tools set to manually installed.
4、安装QT5:
sudo apt install qt5*
5、查看qamke,并记住这个目录,在配置qt_creator工程时需要用到
cat@lubancat:~$ qmake -v
QMake version 3.1
Using Qt version 5.15.3 in /usr/lib/aarch64-linux-gnu
6、打开qt creator

7、添加qmake位置,否则无法编译
按步骤选择:
qtcreator->tools->option->kits->Qtversion->add->/usr/lib/qt5/bin/qmake
/usr/lib/qt5/bin/qmake //qt的编译器安装在这儿
/usr/include/x86_64-linux-gnu/qt5 //QT的头文件在这儿
/usr/lib/x86_64-linux-gnu/qt5 //QT的库文件在这儿
/usr/lib/x86_64-linux-gnu/qt5/bin ->/usr/lib/qt5/bin/

8、新建工程

输入工程名称:

选择qmake:


选择配置好的:

这里选完成就OK了:

双击mainwindow.ui设计界面

添加一个标签为“hello world"

然后回到main.cpp,再点击运行就实现了hello world了。

至此hello world就完成了。
|