1 下载安装文件
从Qt官网或清华大学镜像站https://mirrors.tuna.tsinghua.edu.cn/gnu/gcchttps://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/5.14/5.14.2/下载Qt安装文件。
以清华大学镜像站为例,下载如下:
wget https://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/5.14/5.14.2/qt-opensource-linux-x64-5.14.2.run
或直接在网页上下载。
2 安装Qt5.14.2和Qt Creator
给qt-opensource-linux-x64-5.14.2.run赋予执行权限:
chmod +x qt-opensource-linux-x64-5.14.2.run
执行qt-opensource-linux-x64-5.14.2.run
sudo ./qt-opensource-linux-x64-5.14.2.run
接下来会启动Qt安装界面(需要断网,否则需要输入帐号密码),然后可采用默认选项一直到安装完成,中间可修改安装路径。
3 解决编译问题
初次使用QT编译时出现了以下2个问题:
(1)#error qt requires c++11 support
(2)GL/gl.h:no such file or directory或error: cannot find -lGL
针对第一个问题:需要将GCC编译器版本由CentOS自带的4.9.5升级至高版本(例如,7.5.0,参考**【已解决】将CentOS7系统安装至U盘(三):将gcc版本由4.9.5升级至7.5.0(或更高版本)**https://blog.csdn.net/baidu_41764522/article/details/123442994.
在Qt工具栏Tools->Options->Kits进行编译配置,选择更高版本的Compiler。
CMake可以选择系统CMake,并在Kits中选择。
针对第二个问题:是gl库的问题,安装3个opengl核心库即可,
yum install mesa-libGL-devel mesa-libGLU-devel
yum install freeglut-devel
上一篇:将CentOS7系统安装至U盘(三):将gcc版本由4.9.5升级至7.5.0(或更高版本)
下一篇:https://blog.csdn.net/baidu_41764522/article/details/123444285