VS2015+qgis3.14+qt环境搭建(不用自己编译)
现在网上环境搭建多为qgis2.18等低版本,且大多数要求自己编译,一般自己编译老是出各种问题,最后无奈放弃。。。
1.vs中添加qt插件
2.环境配置
注意:要在release下配置:
在c/c++中配置附件包含目录:
F:\OSGeo4W64\apps\qgis\include
F:\OSGeo4W64\include
F:\OSGeo4W64\apps\Qt5\include
F:\OSGeo4W64\apps\Qt5\include\QtXml//qgis必加
F:\OSGeo4W64\apps\Qt5\include\QtCore
F:\OSGeo4W64\apps\Qt5\include\QtGui
F:\OSGeo4W64\apps\Qt5\include\QtSerialPort//串口通信必加
//------选择性加,缺了再找-----------------------------
F:\OSGeo4W64\apps\Qt5\include\QtNetwork
F:\OSGeo4W64\apps\Qt5\include\QtWebKitWidgets
F:\OSGeo4W64\apps\Qt5\include\QtWidgets
F:\OSGeo4W64\apps\Qt5\include\qwt6
F:\OSGeo4W64\apps\Qt5\include\QtWebKit
F:\OSGeo4W64\apps\Qt5\include\QtCrypto
在链接器中配置lib
F:\OSGeo4W64\apps\Qt5\lib
F:\OSGeo4W64\apps\qgis\lib
F:\OSGeo4W64\lib
在链接库->输入中配置附加依赖项
Qt5Core.lib
Qt5Gui.lib
qgis_core.lib
qgis_app.lib
qgis_gui.lib
Qt5Widgets.lib
Qt5Xml.lib//qt中用qgis需要加
Qt5SerialPort.dll//如果要用qt自带的串口通信需要加
//—选择性加,缺了再找----------------
qtmain.lib
qgis_3d.lib
qgis_analysis.lib
qgis_native.lib
qgis_server.lib
3.配置系统环境:
4测试:
放入一些头文件,看程序能否找到:
//qt
#include <qmessagebox.h>
//gis
#include <qgsvectorlayer.h>
#include <qgsrasterlayer.h>
#include <qgsmapcanvas.h>
#include <qgsrasterlayer.h>
#include<qgsCoordinatetransform.h>
#include<qgsapplication.h>
#include<qgsproviderregistry.h>
#include<qgsmaplayerref.h>
#include<qgsmaplayerrenderer.h>
#include<qgsauthimportcertdialog.h>
///
#include<QtWidgets/QApplication>
#include<qgsapplication.h>
#include<qgsproviderregistry.h>
#include<qgsmaplayerregistry.h>
#include<qgsvectorlayer.h>
#include<qgsmapcanvas.h>
#include <qgssymbollayer.h>
#include <qgssymbol.h>
#include <qgsmarkersymbollayer.h>
#include <qgsvectorlayerrenderer.h>
#include <qgsrendercontext.h>
#include <qgssinglesymbolrenderer.h>
#include <qgssymbollayer.h>
测试程序可以下载我写过的代码:1.https://download.****.net/download/xx970829/13094093
2.https://download.****.net/download/xx970829/13095254
3.https://download.****.net/download/xx970829/13105421
。。。。。。。
5.常见问题:
vs+qt+qgis环境搭建常见问题及解决方案:
https://editor.****.net/md/?articleId=109891607