gwaldron/osgearth

About build osgearth, throw lnk2001 with gdal

Closed this issue · 5 comments

The source code:

  • osgearth (master)
  • osg (master)
  • gdal(3.7.1/3.9.1)
    I can build gdal, osg(with gdal) susccessfuly. when build osgearth, there are always 12 error LNK2001, some functions from gdal can't be link.
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: virtual __cdecl GDALAbstractBandBlockCache::~GDALAbstractBandBlockCache(void)" (??1GDALAbstractBandBlockCache@@UEAA@XZ)
2>GDALDEM.obj : error LNK2001: 无法解析的外部符号 "public: virtual __cdecl GDALAbstractBandBlockCache::~GDALAbstractBandBlockCache(void)" (??1GDALAbstractBandBlockCache@@UEAA@XZ)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: class GDALDataset * __cdecl GDALDriver::Create(char const *,int,int,int,enum GDALDataType,char * *)" (?Create@GDALDriver@@QEAAPEAVGDALDataset@@PEBDHHHW4GDALDataType@@PEAPEAD@Z)
2>GDALDEM.obj : error LNK2001: 无法解析的外部符号 "public: class GDALDataset * __cdecl GDALDriver::Create(char const *,int,int,int,enum GDALDataType,char * *)" (?Create@GDALDriver@@QEAAPEAVGDALDataset@@PEBDHHHW4GDALDataType@@PEAPEAD@Z)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl GDALProxyDataset::UnrefUnderlyingDataset(class GDALDataset *)" (?UnrefUnderlyingDataset@GDALProxyDataset@@MEAAXPEAVGDALDataset@@@Z)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "protected: virtual enum CPLErr __cdecl GDALProxyDataset::IBuildOverviews(char const *,int,int *,int,int *,int (__cdecl*)(double,char const *,void *),void *)" (?IBuildOverviews@GDALProxyDataset@@MEAA?AW4CPLErr@@PEBDHPEAHH1P6AHN0PEAX@Z2@Z)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: virtual void __cdecl GDALProxyDataset::FlushCache(void)" (?FlushCache@GDALProxyDataset@@UEAAXXZ)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: virtual char const * __cdecl GDALProxyDataset::GetProjectionRef(void)" (?GetProjectionRef@GDALProxyDataset@@UEAAPEBDXZ)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: virtual enum CPLErr __cdecl GDALProxyDataset::SetProjection(char const *)" (?SetProjection@GDALProxyDataset@@UEAA?AW4CPLErr@@PEBD@Z)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: virtual char const * __cdecl GDALProxyDataset::GetGCPProjection(void)" (?GetGCPProjection@GDALProxyDataset@@UEAAPEBDXZ)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: virtual enum CPLErr __cdecl GDALProxyDataset::SetGCPs(int,struct GDAL_GCP const *,char const *)" (?SetGCPs@GDALProxyDataset@@UEAA?AW4CPLErr@@HPEBUGDAL_GCP@@PEBD@Z)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl GDALProxyRasterBand::UnrefUnderlyingRasterBand(class GDALRasterBand *)" (?UnrefUnderlyingRasterBand@GDALProxyRasterBand@@MEAAXPEAVGDALRasterBand@@@Z)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: virtual enum CPLErr __cdecl GDALProxyRasterBand::FlushCache(void)" (?FlushCache@GDALProxyRasterBand@@UEAA?AW4CPLErr@@XZ)
2>GDAL.obj : error LNK2001: 无法解析的外部符号 "public: virtual enum CPLErr __cdecl GDALProxyRasterBand::BuildOverviews(char const *,int,int *,int (__cdecl*)(double,char const *,void *),void *)" (?BuildOverviews@GDALProxyRasterBand@@UEAA?AW4CPLErr@@PEBDHPEAHP6AHN0PEAX@Z2@Z)

I confired the lib of gdal is set correctly, and all librarys is build with x64, c++14.
I also run some example of gdal, it works well
Is there some special things I missed? I also try download gdal from gisinternal, and configurate it into osgearth, always those 12 lnk errors.
I also use dumpbin export all funcitons from gdal.lib, I can see those functions in lib.
I'm confused! Thanks so much for anyone who can help!

Are you building GDAL yourself? Or getting it from vcpkg?

I builded gdal from source code, and download gdal from website gis internal. both lib can throw lnk2001 error

I try use gdal(3.8.3) from vcpkg, same errors, and new two error about ogr.
Maybe I change some config of osgerath, that effected.

Sorry I do not know the problem; cannot reproduce it locally. I am using GDAL 3.9.1 from vcpkg as of this writing.

thanks, I will try again if I'm free