1.背景
前些日子,需要在全新安装的银河麒麟系统中安装Qt,中间遇到的问题,记录一下。
2.安装Qt Creator
通过软件商店安装Qt Creator,我已经安装过了所以第3步显示的是“打开”,正常没有安装过的显示的是“下载”。
3.Qt Creator依赖库安装
sudo apt-get install qt5-* qtcreator -y # 安装Qt5默认依赖库,-y参数表示跳过系统提示,直接安装,如果跳过在/usr/lib目录下没有qt的文件夹
sudo apt install build-essential -y # 安装编译器包含g++、gcc、make,-y参数表示跳过系统提示,直接安装
sudo apt install qmlscene -y # 安装qmlscene库,缺少该库Qt提示"qmlscene未安装"
sudo apt install qtdeclarative5-dev -y
4.配置Qt Creator
- 打开Qt Creator,菜单栏–>工具–>选项–>Kits
- 添加qmake
选择/usr/lib/qt5/bin/qmake
,添加完成之后点击“打开”
点击“应用”后点击“确定”
3.配置“构建套件(Kit)”
5.新建工程
正常创建工程即可。
6.新建工程显示警告
警告描述:the code model could not parse an included file, which might lead to incorrect code completion and highlighting, for example.
问题分析:
原因是因为重复包含头文件的原因,qwdialogLocate.h中包含了mainwindow.h头文件,但mainwindow.h头文件又包含了qwdialogLocate.h,所以才会导致这种报错的发生。
解决方案
菜单栏–>帮助–>关于插件
关闭之后重启Qt后警告消失。