Ubuntu 18.04.1 安装QT

想在Ubuntu上玩一下minigui,需要用QT下的QVFB,所以得在我的Ubuntu上先装上Qt
我的Ubuntu版本:

kirin@kirin-VLR-WX9:/home$ uname -a
Linux kirin-VLR-WX9 5.3.0-28-generic #30~18.04.1-Ubuntu SMP Fri Jan 17 06:14:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

QT版本:4.8.6
下载地址:http://download.qt.io/archive/qt/4.8/4.8.6/
点 qt-everywhere-opensource-src-4.8.6.tar.gz下载:
Ubuntu 18.04.1 安装QT_第1张图片
下载后解压到某个地方。
这个版本的QT在这个版本的Linux系统下有一个地方需要修改,否则编译的时候会报错:

In file included from ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastAllocBase.h:84:0,
                from ../3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h:24,
                from ../3rdparty/javascriptcore/JavaScriptCore/pcre/pcre_exec.cpp:50:
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:69: error: ‘std::tr1’ has not been declared
    template struct HasTrivialConstructor : public std::tr1::has_trivial_constructor { };
                                                                    ^~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:74: error: expected ‘{’ before ‘has_trivial_constructor’
emplate struct HasTrivialConstructor : public std::tr1::has_trivial_constructor { };
                                                                    ^~~~~~~~~~~~~~~~~~~~~~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:68: error: ‘std::tr1’ has not been declared
    template struct HasTrivialDestructor : public std::tr1::has_trivial_destructor { };
                                                                   ^~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:73: error: expected ‘{’ before ‘has_trivial_destructor’
template struct HasTrivialDestructor : public std::tr1::has_trivial_destructor { };
                                                                    ^~~~~~~~~~~~~~~~~~~~~~

修改点:

kirin@kirin-VLR-WX9:~/workspace/minigui/qt-everywhere-opensource-src-4.8.6/mkspecs/common$ grep "gnu++98" -rn
g++-base.conf:18:QMAKE_CXX = g++ -std=gnu++98
gcc-base.conf:34:QMAKE_CFLAGS                += -pipe -std=gnu++98

如上,g++ -base.conf 文件第18行 QMAKE_CXX 后面加上 -std=gnu++98
gcc-base.conf第34行**QMAKE_CFLAGS **后面也加上 -std=gnu++98

参考博文:https://blog.csdn.net/baidu_33850454/article/details/79147161

然后配置编译即可:

 make confclean //如果之前配置过先clean一下配置
  ./configure
make
sudo make install 

安装完成后可以到bin下试一下demo:

kirin@kirin-VLR-WX9:~/workspace/minigui/lib/qt-everywhere-opensource-src-4.8.6/bin$ ./qtdemo

Ubuntu 18.04.1 安装QT_第2张图片
里面有各种demo、小游戏啥的:
Ubuntu 18.04.1 安装QT_第3张图片

你可能感兴趣的:(minigui)