[gdal-dev] Statically link ECW v5 with GDAL

Paul Meems bontepaarden at gmail.com
Thu Oct 17 02:30:27 PDT 2013


Hi list,

As mentioned before I'm having trouble getting the new ECW SDK working in
MapWinGIS which is using GDAL.
I'm now trying to statically link ECW v5 with GDAL.
I've found this documentation:
When linking against the static libraries on Windows, you must define
NCSECW_EXPORTS as a pre-processor definition. Both the dynamic and
static libraries on Windows are linked against the dynamic msvc run-time
library (/MD and /MDd).
When linking on Windows platforms, for dynamic libraries link against
NCSEcw.lib and NCSEcwd.lib for release and debug modes respectively. For
static libraries, link against NCSEcwS.lib and NCSEcwSd.lib for release and
debug modes respectively.

I'm compiling GDAL using nmake in a Visual Studio 2008 command prompt.

And I've changed my nmake.local to
ECWDIR   = $(GDAL_HOME)\..\ERDAS-ECW-JPEG-2000-SDK-5.0
ECWFLAGS = -DECWSDK_VERSION=50 *-DNCSECW_EXPORTS* \
           -I$(ECWDIR)\include \
           -I$(ECWDIR)\include/NCSECW/API \
           -I$(ECWDIR)\include/NCSECW/JP2 \
           -I$(ECWDIR)\include/NCSECW/ECW
ECWLIB   = $(ECWDIR)\lib\vc90\$(PLATFORM_NAME)\*NCSEcwS.lib*


I'm not sure about the NCSECW_EXPORTS pre-processor definition. I've added
it to the ECWFLAGS. Is that the correct location and the correct syntax?

We used to compile MapWinGIS with the ECW dll as a delay loaded dll, but
that is now giving me this error:
*fatal error LNK1194: cannot delay-load 'NCSEcw.dll' due to import of data
symbol '"__declspec(dllimport) const NCS::CMutex::`vftable'"
(__imp_??_7CMutex at NCS@@6B@)'; link without /DELAYLOAD:NCSEcw.dll*
I've posted this on the Intergraph forum (
http://geospatial.intergraph.com/Community/forums/p/1620/5299.aspx#5299)
but don't have received any reply.

When compiling gdal with the new nmake.local I can successfully open an ecw
file with gdalinfo.exe, so that part is working.
But when compiling MapWinGIS (using VS2008), which is statically linking
gdal.lib I get these errors:
error LNK2019: unresolved external symbol "__declspec(dllimport) public:
__thiscall NCS::CString::~CString(void)" (__imp_??1CString at NCS@@QAE at XZ)
referenced in function "public: virtual enum CPLErr __thiscall
ECWDataset::SetMetadataItem(char const *,char const *,char const *)"
(?SetMetadataItem at ECWDataset@@UAE?AW4CPLErr@@PBD00 at Z)    gdal.lib
MapWinGIS

Any help is much appreciated.

Thanks,

Paul

 *Paul Meems *
Release manager, configuration manager
and forum moderator of MapWindow GIS.
www.mapwindow.org

Owner of MapWindow.nl - Support for
Dutch speaking users.
www.mapwindow.nl

*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20131017/19a2c233/attachment.html>


More information about the gdal-dev mailing list