[Qgis-developer] Error using QGIS API (unresolved external symbol "public: static struct, QMetaObject const QgsVectorLayer::staticMetaObject") - usage of qobject_cast
SupportLists
supportlists at qlands.com
Sun Aug 12 23:16:56 PDT 2012
Hi,
I traced this error to the use of qobject_cast in lines like:
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>(
mCanvas->currentLayer() );
If I change those lines to use dynamic_cast the linker error disappear
in Windows.
Any idea why?
Many thanks,
Carlos.
On 08/10/2012 05:42 PM, SupportLists wrote:
> Hi,
>
> I am building a custom application use QGIS 1.8.0 but I get the
> following error:
>
> / link /LIBPATH:"c:\Qt\4.8.1\lib" /NOLOGO /DYNAMICBASE
> /NXCOMPAT /DEBUG /M
> ANIFEST /MANIFESTFILE:"debug\nile.intermediate.manifest"
> /SUBSYSTEM:WINDOWS "/MA
> NIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls'
> version='
> 6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*'
> processorArchitecture='*
> '" /OUT:debug\nile.exe @C:\DOCUME~1\CARLOS~1\LOCALS~1\Temp\nmF.tmp
> mapwidget.obj : error LNK2001: unresolved external symbol "public:
> static struct
> QMetaObject const QgsVectorLayer::staticMetaObject"
> (?staticMetaObject at QgsVecto
> rLayer@@2UQMetaObject@@B)
> maptoolselect.obj : error LNK2001: unresolved external symbol "public:
> static st
> ruct QMetaObject const QgsVectorLayer::staticMetaObject"
> (?staticMetaObject at QgsV
> ectorLayer@@2UQMetaObject@@B)
> mapwidget.obj : error LNK2001: unresolved external symbol "public:
> static struct
> QMetaObject const QgsRasterLayer::staticMetaObject"
> (?staticMetaObject at QgsRaste
> rLayer@@2UQMetaObject@@B)
> debug\nile.exe : fatal error LNK1120: 2 unresolved externals
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> 10.0\VC\BI
> N\link.EXE"' : return code '0x460'
> Stop.
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> 10.0\VC\BI
> N\nmake.exe"' : return code '0x2'
> Stop./
>
> My .pro file is defined as:
>
> /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
>
>
> DEFINES += QGISPLUGINDIR=$${QGISPLUGINDIR} CORE_EXPORT= GUI_EXPORT=/
>
> I am using QT 4.8.1 and Visual Studio 2010.
>
> Any idea what is causing the error and how to correct it?
>
> Many thanks in advance,
> Carlos
>
>
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120813/03b59124/attachment.html>
More information about the Qgis-developer
mailing list