Hello,

Using mingw64 5.2 and the OSGeo4W64 network installation, I can't seem to 
compile code using OGRSpatialReference. I don't know if there is something 
wrong with my compiler or with the OSGeo4W package and if anyone else is 
having/had the same problem.

It seems the rest of the GDAL API works, it is just OGRSpatialReference in the 
ogr_spatialref.h that is giving me problems. Interestingly,  code using 
OGRCoordinateTransformation in the same header file compiles properly.

Linker settings:
..\..\..\OSGeo4W64\lib\gdal_i.lib
..\..\..\OSGeo4W64\lib\proj.lib
..\..\..\OSGeo4W64\lib\proj_i.lib

Within main.cpp:

OGRSpatialReference wgs;
wgs.SetWellKnownGeogCS("WGS84");

OGRSpatialReference sfms_epsg;
sfms_epsg.importFromEPSG(42304);

OGRCoordinateTransformation* coordTrans = 
OGRCreateCoordinateTransformation(&wgs, &sfms_epsg);


Errors:

obj\Debug\main.o||In function `main':|
..\main.cpp|145|undefined reference to 
`OGRSpatialReference::OGRSpatialReference(char const*)'|
..\main.cpp|146|undefined reference to 
`OGRSpatialReference::SetWellKnownGeogCS(char const*)'|
..\main.cpp|148|undefined reference to 
`OGRSpatialReference::OGRSpatialReference(char const*)'|
..\SfmsGridQuery\main.cpp|149|undefined reference to 
`OGRSpatialReference::importFromEPSG(int)'|
..\SfmsGridQuery\main.cpp|151|undefined reference to 
`OGRCreateCoordinateTransformation(OGRSpatialReference*, OGRSpatialReference*)'|
..\main.cpp|148|undefined reference to 
`OGRSpatialReference::~OGRSpatialReference()'|
..\main.cpp|145|undefined reference to 
`OGRSpatialReference::~OGRSpatialReference()'|
..\main.cpp|148|undefined reference to 
`OGRSpatialReference::~OGRSpatialReference()'|
..\main.cpp|145|undefined reference to 
`OGRSpatialReference::~OGRSpatialReference()'|

FYI allocating to the heap crashes as well with the same error message i.e., 
OGRSpatialReference wgs = new OGRSpatialReference();


Physical Science, Geoinformatics, Canadian Forest Service
Natural Resources Canada / Government of Canada
[email protected]<mailto:[email protected]> / Tel.: 780-435-7235 (NEW)

Science physique, géoinformatique, Service canadien des forêts
Ressources naturelles Canada / Gouvernement du Canada
[email protected]<mailto:[email protected]> / Tél.: 780-435-7235  (NOUVEAU)

_______________________________________________
osgeo4w-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev

Reply via email to