14.07.2012 5:18, taibc ?????:
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] <[hidden email] </user/SendEmail.jtp?type=node&node=4988339&i=0>> *To:* taibc <[hidden email] </user/SendEmail.jtp?type=node&node=4988339&i=1>>
*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 <http://osgeo-org.1560.n6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>



*Preprocessor.png* (316K) Download Attachment <http://osgeo-org.1560.n6.nabble.com/attachment/4988339/0/Preprocessor.png> *Linker_Input.png* (318K) Download Attachment <http://osgeo-org.1560.n6.nabble.com/attachment/4988339/1/Linker_Input.png> *Project tree.png* (271K) Download Attachment <http://osgeo-org.1560.n6.nabble.com/attachment/4988339/2/Project%20tree.png>

------------------------------------------------------------------------
View this message in context: Re: Error LNK1120: 314 unresolved externals - When using Ogr C++ class on Visual Studio 2010 <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 <http://osgeo-org.1560.n6.nabble.com/GDAL-Dev-f3742093.html> at Nabble.com.


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Try to add to preprocessor definitions:

_WINDOWS
STRICT
_CRT_SECURE_NO_DEPRECATE
_CRT_NONSTDC_NO_DEPRECATE
_USRDLL

Best regards,
    Dmitry
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to