0
我想構建一個應用程序,使用QT和QGIS API(1.8.0)。在Linux下我沒有任何問題(使用Qt 4.7.0),但在Windows下(使用Qt 4.8.1),我得到:使用QGIS API,但獲取無法解析的外部符號「公共:在Windows中的結構QMetaObject const
1>maptoolselect.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QgsVectorLayer::staticMetaObject" ([email protected]@@[email protected]@B)
1>mapwidget.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QgsVectorLayer::staticMetaObject" ([email protected]@@[email protected]@B)
1>mapwidget.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QgsRasterLayer::staticMetaObject" ([email protected]@@[email protected]@B)
1>debug\\nile.exe : fatal error LNK1120: 2 unresolved externals
我.pro文件如下:
QT += core gui sql xml
TARGET = nile
TEMPLATE = app
unix:INCLUDEPATH += /usr/local/gis/include/qgis /usr/local/gis/include ./mapviewsrc
win32:INCLUDEPATH += C:/QGIS/apps/qgis/include C:/QGIS/include ./mapviewsrc
unix:LIBS += -L/usr/local/gis/lib -lgdal -lgeos -lqgis_core -lqgis_gui
win32:LIBS += C:/QGIS/apps/qgis/lib/qgis_core.lib C:/QGIS/apps/qgis/lib/qgis_gui.lib C:/QGIS/lib/geos_c_i.lib C:/QGIS/lib/gdal_i.lib
CONFIG += release
DEFINES += QGISPLUGINDIR=$${QGISPLUGINDIR} CORE_EXPORT= GUI_EXPORT=
兩個類maptoolselect和mapwidget使用QgsVectorLayer和QgsRasterLayer在其類定義中有Q_OBJECT。
任何幫助,非常感謝。
非常感謝, 卡洛斯