2

I'm using Visual Studio 2010 to open and build the GDAL 1.10 source (using the "makegdal10.sln"). This builds without an issue.

Now I want to include the ECW support by including the ECW v5.0 SDK (downloaded from Intergraph). It is installed to "C:\Intergraph\ECWSDK" and the relevant nmake.opt now looks as follows:

ECWDIR  =  "C:\Intergraph\ECWSDK"
ECWFLAGS = -DECWSDK_VERSION=50 \
       -I$(ECWDIR)\include \
       -I$(ECWDIR)\include/NCSECW/api -I$(ECWDIR)\include/NCSECW/jp2 \
       -I$(ECWDIR)\include/NCSECW/ecw
ECWLIB  =  $(ECWDIR)\lib\vc90\win32\NCSEcw.lib 

However when building I get the following errors and have no idea what it means:

Error   6   error LNK1120: 2 unresolved externals   (file)gdal110.dll

Error   5   error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >::~basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >(void)" (__imp_??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@XZ) referenced in function "private: void __thiscall ECWDataset::WriteHeader(void)" (?WriteHeader@ECWDataset@@AAEXXZ)   (file)ecwdataset.obj


Error   4   error LNK2019: unresolved external symbol "__declspec(dllimport) public: wchar_t const * __thiscall std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >::c_str(void)const " (__imp_?c_str@?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPB_WXZ) referenced in function "public: virtual enum CPLErr __thiscall ECWDataset::SetMetadataItem(char const *,char const *,char const *)" (?SetMetadataItem@ECWDataset@@UAE?AW4CPLErr@@PBD00@Z)   (file)gdal-1.10.1\ecwdataset.obj

Error   8   error MSB3073: The command "cd C:\Will\Mapserver\gdal-1.10.1\ && nmake -f makefile.vc MSVC_VER=1500 DEBUG=1 && nmake -f makefile.vc MSVC_VER=1500 DEBUG=1 install" exited with code 2.  C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Target

Error   7   error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.EXE"' : return code '0x460'  ...\gdal-1.10.1\NMAKE   makegdal

Any help or pointers appreciated.

Thanks

  • was your gdal compiled in debug and release mode ? – radouxju Feb 6 '14 at 7:27
  • yes, compiling in release mode – Will S Feb 6 '14 at 23:35
1

I resolved this issue by going through the make file and realizing it is configured for Visual Studio 2008. I made the following changes to the nmake.opt file to get it to build successfully in 2010:

  1. Changed the !IFNDEF MSVC_VER to default to 2010 (not sure this is absolutely necessary):

    !IFNDEF MSVC_VER
    MSVC_VER=1600

    !ENDIF

  2. Pointing to the VC100 folder in the ECW config section since we're compiling on VS2010, this section now looks like this:

    ECWDIR = "C:\Intergraph\ECWSDK"

    ECWFLAGS = -DECWSDK_VERSION=50 \

       -I$(ECWDIR)\include \
    
       -I$(ECWDIR)\include/NCSECW/api -I$(ECWDIR)\include/NCSECW/jp2 \
    
       -I$(ECWDIR)\include/NCSECW/ecw
    

    ECWLIB = $(ECWDIR)\lib\vc100\win32\NCSEcw.lib

Feeling a bit silly, but it's my fist make file troubleshooting effort! Apologies, the formatting seems a bit screwy on the code block above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.