[osgeo4w-dev] Compile errors using gdal111 and OGRSpatialReference
Lu, Bo (NRCan/RNCan)
bo.lu at canada.ca
Fri Jan 22 08:22:28 PST 2016
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
bo.lu at canada.ca<mailto:bo.lu at canada.ca> / Tel.: 780-435-7235 (NEW)
Science physique, géoinformatique, Service canadien des forêts
Ressources naturelles Canada / Gouvernement du Canada
bo.lu at canada.ca<mailto:bo.lu at canada.ca> / Tél.: 780-435-7235 (NOUVEAU)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/osgeo4w-dev/attachments/20160122/780bd456/attachment.html>
More information about the osgeo4w-dev
mailing list