Windows10 + Qt5.11.0 + QGC3.2.0 + VS2015

简介

本文介绍 (QGroundControl, QGC) 的安装配置, QGroundControl 是一个地面站监控软件, 支持 GPU 渲染与加速, 为无人机提供全飞行控制和任务规划, 提供开源代码, 支持Linux, Windows, Android, Mac 等多种平台.

QGroundControl provides full flight control and mission planning for any MAVLink enabled drone. It provides configuration for ArduPilot or PX4 Pro powered vehicles. Its primary goal is ease of use for first time and professional users. All the code is open-source source, so you can contribute and evolve it as you want.

代码基于 Qt 开发框架编写, 下面介绍其安装及配置.

来自网络

环境简介

环境说明

根据 QGC 官网文档 , 配置环境如下, 注意新版QGC3.4仅支持Qt 5.11.0:

  • OSX: OSX 10.7 or higher, 64 bit, clang compiler
  • Ubuntu: 64 bit, gcc compiler
  • Windows: Vista or higher, 32 bit, Visual Studio 2015 compiler
  • iOS: 8.0 and higher
  • Android: Jelly Bean (4.1) and higher. Standard QGC is built against ndk version 19.
  • Qt version: 5.11.0 (only)

资源下载

下载链接如下:

注意: 根据 QGC 官网文档 ,QGC 源码中不包含子模块源码,:

Github source-code zip files cannot be used because these do not contain the appropriate submodule source code. You must use git!

下载时需要使用 git 命令递归克隆, 这样可以同时克隆子模块源码, 直接点击下载 zip 源码包不会包含子模块源码, 不递归克隆, 构建QGC工程源码时会出现 MAVLink folder does not exist … submodule 错误, 参见问题解决的 MAVLink folder does not exist submodule 部分.

Git是一个版本控制系统, 可以到 这里 下载. GitHub是个git远程仓库, 用于存储代码包.下载安装好git后, 打开 Git Bash 命令终端, 输入QGC源码下载命令:

1. Clone the repo (or your fork):
git clone --recursive https://github.com/mavlink/qgroundcontrol.git
2. Enter into the directory
cd qgroundcontrol
3. Update submodules (do this each time you pull new source code):
git submodule update

如下图所示, 其中 recursive 代表递归, 代码比较大(437 MB (459,235,320 字节)), 不使用递归命令, 或者直接下载比较小(394 MB (413,795,660 字节)), 需耐心等待(PS: 可以在等待的过程安装Qt VS等):
git QGC log

代码日志记录如下:

$ git clone --recursive https://github.com/mavlink/qgroundcontrol.git
Cloning into 'qgroundcontrol'...
remote: Enumerating objects: 233, done.
remote: Counting objects: 100% (233/233), done.
remote: Compressing objects: 100% (162/162), done.
Receiving objects: 100% (107431/107431), 324.15 MiB | 20.00 KiB/s, done.
remote: Total 107431 (delta 127), reused 95 (delta 68), pack-reused 107198
Resolving deltas: 100% (81657/81657), done.
Checking out files: 100% (2783/2783), done.
Submodule 'libs/mavlink/include/mavlink/v2.0' (https://github.com/mavlink/c_library_v2.git) registered for path 'libs/mavlink/include/mavlink/v2.0'
Submodule 'src/GPS/Drivers' (https://github.com/PX4/GpsDrivers.git) registered for path 'src/GPS/Drivers'
Cloning into 'F:/zhiliu/github/qgroundcontrol/libs/mavlink/include/mavlink/v2.0'...
remote: Enumerating objects: 174, done.
remote: Counting objects: 100% (174/174), done.
remote: Compressing objects: 100% (140/140), done.
remote: Total 14066 (delta 138), reused 65 (delta 34), pack-reused 13892
Receiving objects: 100% (14066/14066), 6.47 MiB | 129.00 KiB/s, done.
Resolving deltas: 100% (12854/12854), done.
Cloning into 'F:/zhiliu/github/qgroundcontrol/src/GPS/Drivers'...
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (56/56), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 455 (delta 35), reused 48 (delta 30), pack-reused 399
Receiving objects: 100% (455/455), 170.63 KiB | 276.00 KiB/s, done.
Resolving deltas: 100% (329/329), done.
Submodule path 'libs/mavlink/include/mavlink/v2.0': checked out '32dcf73bb24516dc0d52119e624fda8987a03f62'
Submodule path 'src/GPS/Drivers': checked out '8828fb9ad3a2cad568feac2b46de7d6d3af32ca8'

由于 qgroundcontrol 源码比较大, 经常下不下来, git clone 命令不支持断点续传, 故可以使用如下命令下载, 当下载中断时, 再次执行 git fetch 那句命令即可. 打开 Git Bash 终端, 进入你想存放源码的目录(提示: 进入磁盘cd 盘符 , 如 cd E:), 然后执行:

$ mkdir qgroundcontrol
$ cd qgroundcontrol
$ git init
$ git fetch --recurse-submodules https://github.com/mavlink/qgroundcontrol.git
remote: Enumerating objects: 215, done.
remote: Counting objects: 100% (215/215), done.
remote: Compressing objects: 100% (149/149), done.
Receiving objects: 100% (98818/98818), 255.77 MiB | 25.00 KiB/s, done.
remote: Total 98818 (delta 123), reused 84 (delta 66), pack-reused 98603
Resolving deltas: 100% (75211/75211), done.
From https://github.com/mavlink/qgroundcontrol
 * branch                HEAD       -> FETCH_HEAD
$ git pull https://github.com/mavlink/qgroundcontrol.git

也可以单独下载, 然后放到对应目录即可:

  • c_library_v2: 放到 libs/mavlink/include/mavlink/v2.0 目录下;
  • GpsDrivers: 放到 src/GPS/Drivers 目录下.

子模块在QGroundControl源码中的位置

安装与配置

VS 安装与配置

VS 安装

VS安装略过, 记得勾选C++编译器等即可.

一个例子

下面介绍一个例子: 文件 --> 新建 --> 项目 --> win32项目, 输入项目名称, 如 HelloWorld, 确定, 菜单栏 调试 --> 开始调试 , 若提示"无法打开 源 文件 "vcruntime.h" 请参照后面问题解决部分.

下图为程序运行结果:
VS GUI工程示例

Qt & Qt Creator 安装

安装

双击安装程序, 选择安装路径, 安装即可, 注意:

  • 勾选 Qt Creator : 这里自带的版本为 Qt Creator 4.6.1;
  • 勾选 MSVC 2015 32 组件;
  • 如果想使用 MinGW也请勾选.

早期版本中, 以上文件为单独的安装包, 如qt-opensource-windows-x86-msvc2015-5.7.1.exe, 现在做成了组件.

Qt 组件

UWP即Windows 10中的Universal Windows Platform简称。即Windows通用应用平台,在Windows 10 Mobile/Surface(Windows平板电脑)/PC/Xbox/HoloLens等平台上运行,uwp不同于传统pc上的exe应用,也跟只适用于手机端的app有本质区别。它并不是为某一个终端而设计,而是可以在所有windows10设备上运行。

本文在安装时选择安装了 MinGW, MSVC 2015 32 组件, 在 工具–>选项–>构建和运行–>构建套件(Kit) 中可以看到自动检测到的编译器(MSVC的和MinGW的), 在构建项目时选择一个即可.

需要注意的是, 若需调试, 使用MSVC编译器还需安装CDB调试工具, 关于CDB调试, 参考下文 “Qt 中 使用VC部分”.

VS中配置Qt

Qt插件安装

对于VS中Qt插件的安装, 早期版本是下载单独的文件安装, VS2015中安装Qt插件的方法为: VS2015 --> 工具 --> 扩展和更新 弹出的界面选择 联机 在右侧输入 Qt 搜索, 点击下载安装, 安装后重启VS生效, 如下图所示:

在VS中安装Qt插件

如图所示, VS2015中有两个主要Qt插件: Qt Visual Studio Tools, QtPackage, 功能大同小异. 安装好后, 分别对应: Qt VS Tools, QT5.

Qt插件配置

安装完插件需要在插件中配置Qt路径, 菜单栏选择 Qt VS Tools --> Qt Options 或者 QT5 --> Qt Options,在弹出的路径中, 点击 Add 按钮, 选择相应Qt版本所在主目录(如E:\devtools\Qt\Qt5.11.0\5.11.0\msvc2015). 若不进行配置, 在新建工程时会提示

VS中提示没有Qt

一个例子

VS中菜单栏: 文件–>新建 --> 项目, 在弹出的窗口中选择 模版-->Visual C++ --> Qt --> Qt GUI Application , 输入项目名新建项目, 运行弹出如下窗口

VS中使用QT示例

注意: 若出现问题, 请移步下文 “问题与解决” 部分的 “VS使用问题” 小节.

Qt 中配置VC

Qt中使用CDB调试

关于调试, 下载Windows SDk 安装包, 在 windows downloads 里搜索即可, 里面有Debug Tools. 如 Windows 10 SDK: 含调试器等下载, 点击 DOWNLOAD THE .ISO 下载iso文件安装;
安装时选择调试工具

安装 好后 Qt中便可以自动检测到VC++调试器, 如下图所示:

Qt自动检测到的CDB调试器

注意: 若出现问题, 请移步下文 “问题与解决” 部分的 “QT使用问题” 小节.

一个例子

文件–>新建文件或项目–>项目–>Application–>Qt Widgets Application 新建QtGUI工程,

QT程序构建编译运行或调试, 及QT测试例子窗口

至此为止, Qt中可以正常使用VC编译器调试与运行, VS中也可以运行QT工程. 下面介绍QGC的安装.

QGroundControl 编译与安装

打开下载好的含submodules的QGC源码工程. 删掉 qgroundcontrol.pro.user 文件, 构建编译,输出如下日志:

Running Windows Runtime device detection.
No winrtrunner.exe found.
Project MESSAGE: Qt version 5.11.0
Project MESSAGE: Windows build
Project MESSAGE: QGroundControl Development master:bcabdc26a 2018-10-24 15:55:25 -0700
Project MESSAGE: Release flavor
Project MESSAGE: Using Default QtLocation headers
Project MESSAGE: Using MAVLink dialect 'ardupilotmega'.
Project MESSAGE: Skipping support for Zeroconf (unsupported platform)
Project MESSAGE: Skipping support for Airmap (unsupported platform)
Project MESSAGE: Skipping support for video streaming (GStreamer libraries not installed)
Project MESSAGE: Installation instructions here: https://github.com/mavlink/qgroundcontrol/blob/master/src/VideoStreaming/README.md
Project ERROR: Unknown module(s) in QT: charts
Cannot read E:/devtools/Qt/qgroundcontrol/user_config.pri: No such file or directory
Cannot read /.qmake.stash: No such file or directory
Project MESSAGE: Qt version 5.11.0
Project MESSAGE: Windows build
Project MESSAGE: QGroundControl Development master:bcabdc26a 2018-10-24 15:55:25 -0700
Project MESSAGE: Debug flavor
Cannot read E:/pkg-config_wrapper.sh.bat: No such file or directory
Project MESSAGE: Using MAVLink dialect 'ardupilotmega'.
Project MESSAGE: Skipping support for Zeroconf (unsupported platform)
Project MESSAGE: Skipping support for Airmap (unsupported platform)
Project MESSAGE: Skipping support for video streaming (GStreamer libraries not installed)
Project MESSAGE: Installation instructions here: https://github.com/mavlink/qgroundcontrol/blob/master/src/VideoStreaming/README.md
Cannot read E:/moc/mocinclude.opt: No such file or directory
Project ERROR: Unknown module(s) in QT: charts
Cannot read E:/devtools/Qt/qgroundcontrol/user_config.pri: No such file or directory

构建Debug出现错误, 改成Release成功!

成功编译运行结果

问题与解决

VS安装使用问题

Project ERROR: Cannot run compiler ‘cl’. Output:

关于 CL.exe
添加VC编译器路径到 PATH环境变量 (电脑 --> 属性 --> 高级系统设置 --> 环境变量 -->系统变量 ) , 如: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin , 在该文件夹中可以看到 cl.exe .

无法打开 源 文件 “vcruntime.h”

无法打开 源 文件 "vcruntime.h"	HelloWorld	c:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\corecrt.h	10	

无法打开 源 文件错误截图

右击项目 --> 属性 打开项目属性页, 按下图添加包含目录路径:

包含目录添加

按下图添加包含目录路径:

附加库目录添加

QT安装使用问题

C1083: Cannot open include file: ‘type_traits’: No such file or directory

\msvc2015_64\include\QtCore\qglobal.h:45: error: C1083: Cannot open include file: 'type_traits': No such file or directory

然而, 上述文件可以在 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include 中找到, 故添加环境变量来解决此问题, 系统 --> 高级系统设置 --> 环境变量, 在系统变量中新增/添加如下环境变量:

  • INCLUDE: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;%INCLUDE%
  • LIB: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\;%LIB%

添加上述环境变量后即可成功运行QT示例程序.

error: LNK1104: cannot open file ‘msvcprtd.lib’

:-1: error: LNK1104: cannot open file 'msvcprtd.lib'

如果在上一步中, LIB 的路径有误, 或者你添加的环境变量名称为 LIBPATH, 即:

  • LIBPATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\;%LIBPATH%

就会出现此问题, 通过在QT中单击 项目 可以看到环境变量中有 LIB, LIBPATH 两个,事先添加的LIBPATH, 没有添加LIB, 运行提示上述错误, 添加LIB环境变量后错误消失. 当然, 你也可以在QT中添加环境变量, 如下图:

QT中的环境变量设置

QGC

MAVLink folder does not exist submodule

如果你构建QGC出现如下错误,说明你下载的QGC源码中不含 submodule 模块:

Project MESSAGE: Using MAVLink dialect 'ardupilotmega'.
Project ERROR: MAVLink folder does not exist at 'libs/mavlink/include/mavlink/v2.0'! Run 'git submodule init && git submodule update' on the command line.

根据提示, 打开 Git Bash 终端, 运行命令: git submodule init && git submodule update 等待下载完成, 重新构建QGC工程即可.
在这里插入图片描述

Unsupported Windows toolchain, only Visual Studio 2015 is supported

QGC仅支持 VS2015, 然而装的就是VS2015, 再次检查发现是构建套件问题, 删除源码目录中的 qgroundcontrol.pro.user 文件, 重新打开工程, 选择构建套件构建.

: error: Unsupported Windows toolchain, only Visual Studio 2015 is supported

Project ERROR: Unknown module(s) in QT: charts

需要在安装QT时选择安装 Qt Charts.

参考

  • 3
    点赞
  • 50
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
要在Qt中开发QGroundControlQGC)环境,你需要注意Qt的版本和一些依赖项。首先,根据引用,Qt版本5.11.0是可用的版本。因此,你可以从https://download.qt.io/new_archive/qt/5.11/5.11.0/下载并安装这个版本。 接下来,根据引用,你需要安装一些与gstreamer相关的依赖项。你可以通过运行以下命令来安装这些依赖项: list=$(apt-cache --names-only search ^gstreamer1.0-* | awk '{ print $1 }' |grep -v gstreamer1.0-hybris) sudo apt-get install $list sudo apt-get install libgstreamer-plugins-base1.0-dev 最后,根据引用,你可能需要调整系统中的gcc版本。你可以通过以下步骤来完成: 1. 查看当前系统安装的所有gcc版本: ls /usr/bin/gcc* -l 2. 如果gcc版本低于5,那么你无需进行以下安装步骤。如果需要安装gcc 4.8,请运行以下命令: sudo apt-get install gcc-4.8 3. 更改gcc系统默认版本,删除已有的软连接并创建指向gcc 4.8的软连接: sudo rm /usr/bin/gcc sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc 通过以上步骤,你应该能够配置好Qt开发QGC的环境。希望对你有所帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [QTQGC开发环境的配置](https://blog.csdn.net/m0_50848587/article/details/115098562)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值