[Gdal-dev] Problems Linking with Stubs in the precompiled downloadable Win32 Binaries.
Fam. Pool
marisap at telkomsa.net
Mon May 10 16:58:39 EDT 2004
Fo Sheezy -
This is a simplified version of the code - note that I'm using a MapInfo
Data Source, a directory with several .TAB, .DAT, .MAP etc files (so in GDAL
talk: a couple 'o Layers).
bool cVectorLoader::loadOGRVector(char* sVectorMap)
{
//DataSet
OGRDataSource* poDataSet = (OGRDataSource*)
OGRSFDriverRegistrar::Open(sVectorMap, false);
if (poDataSet == NULL)
{
return false;
}
const char* sName = poDataSet->GetName();
int iNrOfLayers = poDataSet->GetLayerCount();
cout << endl << "<OGR> Report for Vector Dataset " << sName << endl;
cout << "Dataset has " << iNrOfLayers << " layer(s)." << endl;
//Layers
for (int i=0; i < iNrOfLayers; i++)
{
cout << "For layer " << i+1 << endl;
OGRLayer* poLayer = (OGRLayer*) poDataSet->GetLayer(i);
if (poLayer != NULL)
{
//Features
int iNrOfFeatures = poLayer->GetFeatureCount(true);
OGRFeature* poFeature = (OGRFeature*) poLayer->GetNextFeature();
cout << "Layer has " << iNrOfFeatures << " features" << endl;
int j=1;
while (poFeature != NULL)
{
//Style
cout << "Feature " << j << " with ID " << poFeature->GetFID()
<< " and Style String " << poFeature->GetStyleString () <<
endl;
OGRStyleTable oStyleTable;
OGRStyleTool* poStyleTool;
OGRStyleMgr* poStyleMgr = new OGRStyleMgr(&oStyleTable);
poStyleMgr->GetStyleString(poFeature);
for (int k=0; poStyleMgr->GetPartCount(); k++)
{
poStyleTool = poStyleMgr->GetPart(k);
switch(poStyleTool->GetType())
{
case OGRSTCNone: cout << "Style = None" << endl;
break;
case OGRSTCPen: cout << "Style = Pen" << endl;
break;
case OGRSTCBrush: cout << "Style = Brush" << endl;
break;
case OGRSTCSymbol: cout << "Style = Symbol" << endl;
break;
case OGRSTCLabel: cout << "Style = Label" << endl;
break;
}
}
...
poFeature = (OGRFeature*) poLayer->GetNextFeature();
j++;
}
}
}
cout << endl << "<OGR> End of Report" << endl;
//Clean up
delete poDataSet;
//Function completed successfully
return true;
}
Compilation is all good. When linking I get ze following errors.
Linking...
Creating library Debug/MapViewer.lib and object Debug/MapViewer.exp
cMapVisual.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStylePen" (?asStylePen@@3PAUogr_style_param@@A)
cVectorLoader.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStylePen" (?asStylePen@@3PAUogr_style_param@@A)
MapViewer.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStylePen" (?asStylePen@@3PAUogr_style_param@@A)
cMapVisual.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleBrush" (?asStyleBrush@@3PAUogr_style_param@@A)
cVectorLoader.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleBrush" (?asStyleBrush@@3PAUogr_style_param@@A)
MapViewer.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleBrush" (?asStyleBrush@@3PAUogr_style_param@@A)
cMapVisual.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleSymbol" (?asStyleSymbol@@3PAUogr_style_param@@A)
cVectorLoader.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleSymbol" (?asStyleSymbol@@3PAUogr_style_param@@A)
MapViewer.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleSymbol" (?asStyleSymbol@@3PAUogr_style_param@@A)
cMapVisual.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleLabel" (?asStyleLabel@@3PAUogr_style_param@@A)
cVectorLoader.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleLabel" (?asStyleLabel@@3PAUogr_style_param@@A)
MapViewer.obj : error LNK2001: unresolved external symbol "struct
ogr_style_param * asStyleLabel" (?asStyleLabel@@3PAUogr_style_param@@A)
Debug/MapViewer.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
I'm using gdal_i.lib => gdal12.dll, the ones from the downloadable binaries.
I should add that for the past three yrs I've been a Java Boy and for the
last two weeks I've been brushing up on my C skills, which I haven't used
since my Varsity days. I could just be doing something stupid. However,
everything links fine when I comment out the Style Tool thingies.
BTW Frank - thanks for the great library!
Louis.
-----Original Message-----
From: gdal-dev-admin at remotesensing.org
[mailto:gdal-dev-admin at remotesensing.org]On Behalf Of Frank Warmerdam
Sent: 10 May 2004 10:09
To: gdal-dev at remotesensing.org
Subject: Re: [Gdal-dev] Problems Linking with Stubs in the precompiled
downloadable Win32 Binaries.
Fam. Pool wrote:
> Hi,
>
> I'm quite new to the GDAL world and sofar its gone quite smoothly - but
> today I tried using OGR Style Tools and now I'm getting unresolved symbol
> errors when linking the libs. Its just looks as tho something was left out
> of the precompiled binaries. I'm going to try building the GDAL package
from
> scratch and see if the stubs the scripts generate solve the problem.
Still,
> I like doing things the easy way. If someone could verify the integrity of
> the pre-compiled Win32 binaries that would be swell.
Louis,
There are indeed some issues with linking against the DLL version of OGR
and using some of the style related classes. I am a bit uncertain what
the exact problem is, but if you can list your link errors, and provide
a smallish example program that demonstrates the problem I will try and fix
it. I have run into a similar problem with MapServer but never succeeded in
resolve it.
Note, the problem can be worked around by linking against static versions of
OGR but if possible i would prefer to just fix the base problem.
Best regards,
--
---------------------------------------+------------------------------------
--
I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
_______________________________________________
Gdal-dev mailing list
Gdal-dev at remotesensing.org
http://remotesensing.org/mailman/listinfo/gdal-dev
More information about the Gdal-dev
mailing list