欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ubuntu 18.04.1 安装QT

程序员文章站 2022-05-30 14:18:03
...

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

aaa@qq.com:/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
下载后解压到某个地方。
这个版本的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<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
                                                                    ^~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:173:74: error: expected ‘{’ before ‘has_trivial_constructor’
emplate<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
                                                                    ^~~~~~~~~~~~~~~~~~~~~~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:68: error: ‘std::tr1’ has not been declared
    template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
                                                                   ^~~
../3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h:174:73: error: expected ‘{’ before ‘has_trivial_destructor’
template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
                                                                    ^~~~~~~~~~~~~~~~~~~~~~

修改点:

aaa@qq.com:~/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:

aaa@qq.com:~/workspace/minigui/lib/qt-everywhere-opensource-src-4.8.6/bin$ ./qtdemo

Ubuntu 18.04.1 安装QT
里面有各种demo、小游戏啥的:
Ubuntu 18.04.1 安装QT

相关标签: minigui