Ubuntu安装qt-opensource-linux-x64-5.11.1教程

登陆qt官方下载页面:http://download.qt.io/archive/qt/

本文以安装qt-opensource-linux-x64-5.11.1为例。

 

把下载好的qt-opensource-linux-x64-5.11.1.run放进Linux系统里。首先给qt-opensource-linux-x64-5.11.1.run运行权限,再运行。

sudo chmod +x qt-opensource-linux-x64-5.11.1.run

ls

sudo ./qt-opensource-linux-x64-5.11.1.run

 

选择软件存储目录,最好选择默认目录

选择安装组件,可以只安装三个红色方框,最好全选。

点击安装之后,需要等待一段时间安装完成。

在命令行中输入:sudo gedit /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf

打开default.conf文件,

将第一行改为bin目录的路径,第二行改为qt5.8.0目录的路径,然后保存退出。
 

在安装目录找到qtcreator,双击打开qtcreator。

可以直接把qtcreator固定在工具,为了下次方便打开。

现在,新建一个工程helloword,测试一下。

设置项目名称和项目路径。

点击运行

如果出现:-1: error: cannot find -lGL错误,那是没有安装libgl1-mesa-dev

sudo apt-get install libgl1-mesa-dev

执行sudo apt-get install libgl1-mesa-dev完成后,回到qtcreator界面,重新运行项目,就出现mainWindow界面了。至此,qt-opensource-linux-x64-5.11.1算是安装成功了。

leovo@leovo-pc:/media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/build$ ../configure -prefix /opt/qt-5.11.1 -opensource -confirm-license -release -shared -nomake examples -nomake tests -skip qtwebengine -skip qtwebview -skip qt3d -skip qtcanvas3d -skip qtgamepad -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebsockets -skip qtx11extras -skip qtxmlpatterns -qt-libpng -qt-libjpeg -qt-zlib -qt-pcre -qt-freetype -sql-mysql + cd qtbase + /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/configure -top-level -prefix /opt/qt-5.11.1 -opensource -confirm-license -release -shared -nomake examples -nomake tests -skip qtwebengine -skip qtwebview -skip qt3d -skip qtcanvas3d -skip qtgamepad -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtspeech -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebsockets -skip qtx11extras -skip qtxmlpatterns -qt-libpng -qt-libjpeg -qt-zlib -qt-pcre -qt-freetype -sql-mysql Preparing build tree... Creating qmake... ....................................................................................../media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:110:12: error: ‘int renameat2(int, const char*, int, const char*, unsigned int)’ was declared ‘extern’ and later ‘static’ [-fpermissive] 110 | static int renameat2(int oldfd, const char *oldpath, int newfd, const char *newpath, unsigned flags) | ^~~~~~~~~ In file included from /usr/include/c++/9/cstdio:42, from /usr/include/c++/9/ext/string_conversions.h:43, from /usr/include/c++/9/bits/basic_string.h:6493, from /usr/include/c++/9/string:55, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/include/QtCore/../../src/corelib/tools/qbytearray.h:52, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/include/QtCore/qbytearray.h:1, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/include/QtCore/../../src/corelib/tools/qstring.h:49, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/include/QtCore/qstring.h:1, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/include/QtCore/../../src/corelib/io/qiodevice.h:50, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/include/QtCore/qiodevice.h:1, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/include/QtCore/../../src/corelib/io/qfiledevice.h:43, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/include/QtCore/qfiledevice.h:1, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/src/corelib/io/qfile.h:44, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/src/corelib/io/qfilesystemengine_p.h:54, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:43: /usr/include/stdio.h:164:12: note: previous declaration of ‘int renameat2(int, const char*, int, const char*, unsigned int)’ 164 | extern int renameat2 (int __oldfd, const char *__old, int __newfd, | ^~~~~~~~~ /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:115:12: error: ‘int statx(int, const char*, int, unsigned int, statx*)’ was declared ‘extern’ and later ‘static’ [-fpermissive] 115 | static int statx(int dirfd, const char *pathname, int flag, unsigned mask, struct statx *statxbuf) | ^~~~~ In file included from /usr/include/aarch64-linux-gnu/bits/statx.h:39, from /usr/include/aarch64-linux-gnu/sys/stat.h:446, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/mkspecs/linux-g++/qplatformdefs.h:75, from /media/leovo/DATA/qt-everywhere-src-5.11.1/qt-everywhere-src-5.11.1/qtbase/src/corelib/io/qfilesystemengine_unix.cpp:42: /usr/include/aarch64-linux-gnu/bits/statx-generic.h:56:5: note: previous declaration of ‘int statx(int, const char*, int, unsigned int, statx*)’ 56 | int statx (int __dirfd, const char *__restrict __path, int __flags, | ^~~~~ make: *** [Makefile:423:qfilesystemengine_unix.o] 错误 1
最新发布
12-01
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值