Thanks Dmitry,
Please see attached files for screenshots.
Here is the code of the main.cpp (the project only includes this file):
#include <iostream>
#include "ogrsf_frmts.h"
using namespace std;
int main()
{
OGRRegisterAll();
OGRDataSource *poDS;
poDS = OGRSFDriverRegistrar::Open( "point.shp", FALSE );
if( poDS == NULL )
{
printf( "Open failed.\n" );
exit( 1 );
}
OGRLayer *poLayer;
poLayer = poDS->GetLayerByName( "point" );
OGRFeature *poFeature;
poLayer->ResetReading();
while( (poFeature = poLayer->GetNextFeature()) != NULL )
{
OGRFeatureDefn *poFDefn = poLayer->GetLayerDefn();
int iField;
for( iField = 0; iField < poFDefn->GetFieldCount(); iField++ )
{
OGRFieldDefn *poFieldDefn = poFDefn->GetFieldDefn( iField );
if( poFieldDefn->GetType() == OFTInteger )
printf( "%d,", poFeature->GetFieldAsInteger( iField ) );
else if( poFieldDefn->GetType() == OFTReal )
printf( "%.3f,", poFeature->GetFieldAsDouble(iField) );
else if( poFieldDefn->GetType() == OFTString )
printf( "%s,", poFeature->GetFieldAsString(iField) );
else
printf( "%s,", poFeature->GetFieldAsString(iField) );
}
OGRGeometry *poGeometry;
poGeometry = poFeature->GetGeometryRef();
if( poGeometry != NULL
&& wkbFlatten(poGeometry->getGeometryType()) == wkbPoint )
{
OGRPoint *poPoint = (OGRPoint *) poGeometry;
printf( "%.3f,%3.f\n", poPoint->getX(), poPoint->getY() );
}
else
{
printf( "no point geometry\n" );
}
OGRFeature::DestroyFeature( poFeature );
}
OGRDataSource::DestroyDataSource( poDS );
return 0;
}
Thanks and regards,
Tai
________________________________
From: Dmitry Baryshnikov [via OSGeo.org]
<[email protected]>
To: taibc <[email protected]>
Sent: Friday, July 13, 2012 5:43 PM
Subject: Re: Error LNK1120: 314 unresolved externals - When using Ogr C++ class
on Visual Studio 2010
Hi Tai,
Please post your code and screenshots of project tree and properties
Linker ->Input and C/C++ -> Preprocessor definitions
Best regards,
Dmitry
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
________________________________
If you reply to this email, your message will be added to the discussion below:
http://osgeo-org.1560.n6.nabble.com/Error-LNK1120-314-unresolved-externals-When-using-Ogr-C-class-on-Visual-Studio-2010-tp4988103p4988193.html
To unsubscribe from Error LNK1120: 314 unresolved externals - When using Ogr
C++ class on Visual Studio 2010, click here.
NAML
--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/Error-LNK1120-314-unresolved-externals-When-using-Ogr-C-class-on-Visual-Studio-2010-tp4988103p4988339.html
Sent from the GDAL - Dev mailing list archive at Nabble.com._______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev