[Gdal-dev] Reading/Writing via GDAL library

Tommy Chheng tcchheng at ucsd.edu
Sun Apr 22 00:54:25 EDT 2007


I will be using the GDAL in conjunction with OSSIM, but for this error, 
I commented out the OSSIM-specific code and just ran the tutorial code.

This is one of the errors that I'm encountering
:C:/ossimcvs/ossimConsole/ship_detect.cpp:(.text+0x22): undefined reference
to `OGRSFDriverRegistrar::Open(char const*, int, OGRSFDriver**)'

I have gdal14.dll and I tried linking it using:
-L/c/ossimcvs/gdal-1.4.0/lib -lgdal
-L/c/ossimcvs/gdal-1.4.0/lib -lgdal14
-L/c/ossimcvs/gdal-1.4.0/lib -l"gdal14.dll"

All with the same error.  Any ideas why it isn't linking correctly?

Thanks,
Tommy

Ari Jolma wrote:
> t chheng kirjoitti:
>> Hi,
>> I'm trying to read/write to vector shapefiles using the GDAL/OGR 
>> library.
>> I have compiled gdal-1.4.0 and have gdal14.dll
>>
>> Now I'm trying to use the example code from the tutorial to get the 
>> sample
>> read/write of vector files working.
>> http://www.gdal.org/ogr/ogr_apitut.html
>>
>> My sample code is basically
>> #include <ogrsf_frmts.h>
>> int main(int argc, char* argv[])
>> {
>>                 readShapeFile();
>> return 0;
>> }
>> where readShapeFile is the code provided from the tutorial.
>>
>> When I compile(note that the dll location is specified
>> -L/c/ossimcvs/gdal-1.4.0/lib -lgdal, i also tried -lgdal14), i get an
>> undefined reference error.
>>
>> C:\msys\1.0\bin\make all
>> if [ ! -d /.shared_obj ] ; then mkdir /.shared_obj ; fi
>> g++ -mthreads -Wall -pipe  -O2 -g3  -L/c/Imaging/OpenCV/lib -lcxcore 
>> -lcv
>> -lhighgui -lcvaux -L/c/ossimcvs/bin -lossimcontrib_plugin 
>> -L/c/ossimcvs/bin
>> -lossimopencv_plugin -L/c/ossimcvs/gdal-1.4.0/lib -lgdal  ship_detect.o
>> -L/c/ossimcvs/ossim/lib/ossim -lossim          
>> -L/c/ossimcvs/libgeotiff-1.2.3/lib -L/c/ossimcvs/tiff-3.8.2/lib 
>> -lgeotiff
>> -ltiff  -L/c/ossimcvs/jpeg-6b -ljpeg -lm  -ljpeg -o ship_detect.exe
>> Info: resolving ossimProjection::RTTI_obj       by linking to
>> __imp___ZN15ossimProjection8RTTI_objE (auto-import)
>> Info: resolving vtable for ossimStdOutProgressby linking to
>> __imp___ZTV19ossimStdOutProgress (auto-import)
>> ship_detect.o: In function
>> `ZNSt6vectorI7BlobBoxSaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_':C:/ossimcvs/ossimConsole/ship_detect.cpp:(.text+0xe): 
>>
>> undefined reference to `OGRRegisterAll'
>> :C:/ossimcvs/ossimConsole/ship_detect.cpp:(.text+0x22): undefined 
>> reference
>> to `OGRSFDriverRegistrar::Open(char const*, int, OGRSFDriver**)'
>>
>> Any ideas why it isn't finding the correct references?
>>   
>
> Why do you need to link in the ossim stuff anyway (the undefined 
> reference is from ossim)? Are your ossim binaries working?
>
> Ari
>
>> Thanks
>>
>>
>>   
>
>




More information about the Gdal-dev mailing list