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

Ubuntu18安装Qt4.8.6+QtCreate4.12

程序员文章站 2022-05-28 11:53:53
...

下载安装包

http://download.qt.io/official_releases/qtcreator/4.12/4.12.0/qt-creator-opensource-linux-x86_64-4.12.0.run

http://download.qt.io/archive/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz

ubuntu18 gcc版本为8,会导致编译错误

Makefile:1624: recipe for target 'obj/release/pcre_exec.o' failed
make[1]: *** [obj/release/pcre_exec.o] Error 1
make[1]: 离开目录“/home/dhtc/qt-everywhere-opensource-src-4.8.6/src/script”
Makefile:565: recipe for target 'sub-script-make_default-ordered' failed
make: *** [sub-script-make_default-ordered] Error 2

 安装gcc , g++ 4.8版本

sudo apt-get install gcc-4.8

sudo apt-get install g++-4.8

添加编译器版本控制选项

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 20 
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 30 

删除命令为

sudo update-alternatives --remove gcc /usr/bin/g++-8
sudo update-alternatives --remove gcc /usr/bin/g++-4.8

 

切换不同版本gcc g++命令

sudo update-alternatives --config gcc

编译Qt4.8.6

./configure 
make
make install

默认安装路径为/usr/local/Trolltech/Qt-4.8.6

安装QtCreator4.12

./qt-creator-opensource-linux-x86_64-4.12.0.run

配置编译器
工具-》选项-》 Kits
Qt Version 添加/usr/local/Trolltech/Qt-4.8.6/bin/qmake
Kits-》桌面默认Qt version 选择Qt 4.8.6

Ubuntu18安装Qt4.8.6+QtCreate4.12

Ubuntu18安装Qt4.8.6+QtCreate4.12

创建项目
编译报错/home/dhtc/test1/mainwindow.h:15: error: ‘nullptr’ was not declared in this scope
老版本不支持,修改 nullptr为 NULL