[gdal-dev] Error LNK1120: 314 unresolved externals - When using Ogr C++ class on Visual Studio 2010

taibc taibc_coltech at yahoo.com
Fri Jul 13 18:18:18 PDT 2012


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] <ml-node+s1560n4988193h2 at n6.nabble.com>
To: taibc <taibc_coltech at yahoo.com> 
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120713/d5d4dd44/attachment.html>


More information about the gdal-dev mailing list