centos6.5下qt5.7源码安装

1.前提,gcc升级至4.8以上

2.下载源码wget http://mirrors.ustc.edu.cn/qtproject/archive/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.tar.gz

3.解压tar zxvf qt-everywhere-opensource-src-5.7.0.tar.gz

4.重命名mv qt-everywhere-opensource-src-5.7.0 qt5.7

5.进入目录cd qt5.7/

6.配置./configure -nomake examples -nomake tests -skip purchasing -skip canvas3d -skip virtualkeyboard -skip gamepad -qt-xcb

7.编译make

8.安装make install

9.编辑profile文件 vim /etc/profile,将路径导出到系统

PATH=/usr/local/Qt-5.7.0/bin:$PATH
export PATH

10.刷新环境

source /etc/profile

11.查看qmake版本 qmake -v

12.编写测试代码

pro文件

QT += core

QT -= gui

CONFIG += c++11
TARGET = test3
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

main.cpp

#include <QCoreApplication>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    cout<<"hello qt"<<endl;
    return a.exec();
}
 
 

猜你喜欢

转载自blog.csdn.net/fanhenghui/article/details/82805768
今日推荐