1.安装Qt的基本库与IDE
sudo apt-get install qt5-default
sudo apt-get install qtcreator
2.安装qmake Cmake
sudo apt-get install qt5-qmake
sudo apt install cmake
3.安装g++,gcc
sudo apt install g++ gcc
4.安装QtQucik库 用来开发qml页面
sudo apt-get install qtdeclarative5-dev
5.安装QMLmodule
sudo apt install qml-module-qtquick-controls2
6.安装QtMultimedia库
sudo apt-get install qtmultimedia5-dev
sudo apt-get install libqt5multimedia5-plugins
sudo apt install qml-module-qtmultimedia
7.其他开发库
sudo apt install qml-module-qtquick-extras
sudo apt install qml-module-qt-labs-platform
8.编译安装mqtt
cd /home/linaro/kaifa
git init
git clone git://code.qt.io/qt/qtmqtt.git
git branch -a
cd qtmqtt/
git checkout origin/5.15.2
qmake
make -j8
等待编译完成后安装
make install
9.编译QtLocation 解决Unknown module(s) in QT: location-private positioning-private
cd /home/linaro/kaifa
git init
git clone git://code.qt.io/qt/qtlocation.git
git branch -a
cd qtlocation/
git checkout origin/5.15
mkdir build
cd build
sudo apt install qtbase5-private-dev qtdeclarative5-private-dev
qmake ../qtlocation.pro
make -j8
等待编译完成后安装
make install
10.位置定位相关
sudo apt install qtbase5-private-dev
sudo apt install qtlocation5-dev qtpositioning5-dev
安装qt例子 apt-get install qtbase5-examples
总结
1.在qt的pro文件缺少Qt+=的模块时 需要源码编译或使用命令直接安装
直接安装:
Unknown module(s) in QT: webchannel webengine
sudo apt install qtwebengine5-dev
Unknown module(s) in QT: webview
sudo apt install libqt5webview5-dev
下载源码编译:安装mqtt
2.在qml中import导入的包可以直接使用命令下载
QML module not found(QtQuick.Controls)
apt-get install qml qmlscene
apt-get install qtdeclarative5-dev
apt -y install qml-module-qtquick-controls
apt -y install qml-module-qtquick-controls2
QML module not found(QtQuick.Dialogs)
apt install qml-module-qtquick-dialogs
module "QtQuick.Shapes" is not installed
apt install qml-module-qtquick-shapes
"Qt.labs.folderlistmodel" is not installed
apt install qml-module-qt-labs-folderlistmodel
"Qt.labs.settings" is not installed
apt install qml-module-qt-labs-settings
“QtWebChannel” is not installed
sudo apt install qml-module-qtwebengine
sudo apt install qml-module-qtwebview
sudo apt install qml-module-qtwebchannel文章来源:https://www.toymoban.com/news/detail-625834.html
如果在运行某些程序报错原因是缺少某些库
可用sudo apt install lib* 或者qml*来模糊匹配可能需要的库(根据遇到的错误报告来安装)
文链接:https://blog.csdn.net/weixin_39466327/article/details/127647237文章来源地址https://www.toymoban.com/news/detail-625834.html
到了这里,关于linux(ubuntu)下用命令行安装qt环境的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!