내 프로젝트는 여러 하위 프로젝트로 구성되며 그 중 하나에는 QGIS 라이브러리가 포함됩니다.Qt Creator에서 독립 실행 형 C++ 응용 프로그램이 설치된 QGIS
.PRO 파일 :
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
Utils \
Maps \
GoogleMapsInterface \
Positioning \
NetworkObjects \
DataBaseManager \
SensorNetworkUI \
이는 QGIS 라이브러리를 포함지도의 .PRO 파일입니다 :
CONFIG += c++11
CONFIG += staticlib
TEMPLATE = lib
QT += core gui
QT += widgets
QT += xml
TARGET = maps
DEFINES += MAPS_INTERFACE
INCLUDEPATH += "C:/OSGeo4W/apps/qgis/include/"
INCLUDEPATH += "C:/OSGeo4W/include/"
win32:CONFIG(Release, Debug|Release) {
LIBS += -LC:/OSGeo4W/lib/ -lQtCore4
LIBS += -LC:/OSGeo4W/lib/ -lQtGui4
LIBS += -LC:/OSGeo4W/lib/ -lQtXml4
}
else:win32:CONFIG(Debug, Debug|Release) {
PRE_TARGETDEPS += C:/OSGeo4W/lib/QtCored4.lib
PRE_TARGETDEPS += C:/OSGeo4W/lib/QtGuid4.lib
PRE_TARGETDEPS += C:/OSGeo4W/lib/QtXmld4.lib
LIBS += -LC:/OSGeo4W/lib/ -lQtCored4
LIBS += -LC:/OSGeo4W/lib/ -lQtGuid4
LIBS += -LC:/OSGeo4W/lib/ -lQtXmld4
}
LIBS += -LC:/OSGeo4W/lib -lgdal_i -lgeos_c
LIBS += -LC:/OSGeo4W/apps/qgis-dev/lib -lqgis_core -lqgis_gui
DEFINES += CORE_EXPORT=__declspec(dllexport)
DEFINES += GUI_EXPORT=__declspec(dllexport)
이 SensorNetworkUI의 .PRO 파일입니다
CONFIG += console
TARGET = SensorNetwork
TEMPLATE = app
greaterThan(QT_MAJOR_VERSION, 4):
QT += widgets
QT += core gui
QT += opengl
QT += sql
QT += xml
QT += multimedia
INCLUDEPATH += ../
INCLUDEPATH += "C:/OSGeo4W/apps/qgis/include/"
INCLUDEPATH += "C:/OSGeo4W/include/"
win32:CONFIG(Release, Debug|Release) {
LIBS += -LC:/OSGeo4W/lib/ -lQtCore4
LIBS += -LC:/OSGeo4W/lib/ -lQtGui4
LIBS += -LC:/OSGeo4W/lib/ -lQtXml4
}
else:win32:CONFIG(Debug, Debug|Release) {
PRE_TARGETDEPS += C:/OSGeo4W/lib/QtCored4.lib
PRE_TARGETDEPS += C:/OSGeo4W/lib/QtGuid4.lib
PRE_TARGETDEPS += C:/OSGeo4W/lib/QtXmld4.lib
LIBS += -LC:/OSGeo4W/lib/ -lQtCored4
LIBS += -LC:/OSGeo4W/lib/ -lQtGuid4
LIBS += -LC:/OSGeo4W/lib/ -lQtXmld4
}
DEFINES += CORE_EXPORT=__declspec(dllexport)
DEFINES += GUI_EXPORT=__declspec(dllexport)
LIBS += -LC:/OSGeo4W/lib -lgdal_i -lgeos_c
LIBS += -LC:/OSGeo4W/apps/qgis-dev/lib -lqgis_core -lqgis_gui
LIBS += -L../ -ldbmanager -lsnobjects -lpositioning -lsnutils -lmaps
을 그러나 0123과 같은 오류가 발생합니다.
maps.lib(moc_ClickTool.obj) : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsFeature const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsFeature const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
Qt Creator에서 제공 한 자동 완성 제안에는 QGIS 헤더 파일이 포함되어 있지 않은 것으로 나타났습니다. 이것이 Qt Creator가 그들을 찾을 수 없다는 것을 의미합니까? 전체 이름을 입력하면 오류가 발생하지 않습니다. Qt Creator에서 헤더 파일을 열 수도 있습니다.
누군가 내가 잘못 가고 있다고 말할 수 있습니까?
편집 : 오류가 시작이되는 경우 :
Creating library ..\SensorNetwork.lib and object ..\SensorNetwork.exp
maps.lib(moc_ClickTool.obj) : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsFeature const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsFeature const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
maps.lib(MapCanvas.obj) : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsFeature const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
maps.lib(ClickTool.obj) : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsFeature const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
maps.lib(moc_MapCanvas.obj) : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsFeature const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
maps.lib(moc_ClickTool.obj) : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsExpressionContext const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsExpressionContext const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
maps.lib(MapCanvas.obj) : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QgsExpression::Function::func(class QList<class QVariant> const &,class QgsExpressionContext const *,class QgsExpression *)" ([email protected]@[email protected]@[email protected]@[email protected]@@@@[email protected]@[email protected]@Z)
...
...
maps.lib(MapCanvas.obj) : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QgsRasterDataProvider::staticMetaObject" ([email protected]@@[email protected]@B)
maps.lib(MapCanvas.obj) : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QgsRasterLayer::staticMetaObject" ([email protected]@@[email protected]@B)
maps.lib(ClickTool.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall QgsMapTool::renderComplete(void)" ([email protected]@@UAEXXZ)
maps.lib(ClickTool.obj) : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QgsMapTool::isTransient(void)const " ([email protected]@@UBE_NXZ)
maps.lib(ClickTool.obj) : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QgsMapTool::isEditTool(void)const " ([email protected]@@UBE_NXZ)
..\SensorNetwork.exe : fatal error LNK1120: 93 unresolved externals
jom: D:\Atmika\Sensor_Network\build\win32\Debug\SensorNetworkUI\Makefile.Debug [..\SensorNetwork.exe] Error 1120
jom: D:\Atmika\Sensor_Network\build\win32\Debug\SensorNetworkUI\Makefile [debug] Error 2
14:21:50: The process "D:\Qt\Qt5.7.1\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project Sensor_Network (kit: Desktop Qt 5.7.1 MSVC2015 32bit)
When executing step "Make"
감사하지만 올바른 버전을 가리키고 있는지 어떻게 확인합니까? OSGeo4W를 사용하여 qgis 라이브러리와 헤더를 다운로드했습니다. – user2522981
확인을 위해 마지막 버전을 다운로드하지만 모두 다운로드 한 경우는 거의 없습니다. 버전은 대개 lib 이름 (또는 Linux의 simlinks)에서 직접 확인하고 지정합니다. "SensorNetworkUI"프로젝트 자체를 컴파일 할 때 오류가 발생합니까? 아니면 더 완벽한 빌드 로그가 있습니까?그런데 INCLUDEPATH의 경우 따옴표 나 후행이 필요하지 않습니다./ –
예 .. SensorNetworkUI 프로젝트를 컴파일 할 때만 오류가 발생합니다. – user2522981