[gdal-dev] Member function GDALRasterBand::RasterIO has inconsistent declaration and implementation
HU Yaoyu
yyhu_live at outlook.com
Thu Dec 13 22:48:51 PST 2018
Hi all,
I am a new guy to GDAL. I encountered a simple problem when trying to
link against the GDAL library.
I am working with Version 2.3.2 and Ubuntu 16.04 LTS 64bit. I downloaded
the source code, did a configure with no arguments and compiled the
library. After compiling, I performed an install operation to install
GDAL to /usr/local.
When I tried to link my code against /usr/local/lib/libgdal.so<http://libgdal.so> I got the
following error:
undefined reference to `GDALRasterBand::RasterIO(GDALRWFlag, int, int,
int, int, void*, int, int, GDALDataType, int, int)'
I was using cmake and did a successful find_package(GDAL) with
environment variable GDAL_DIR set to /usr/local. Then I specified the
dependencies with target_link_libraries( ) and the cmake variable
${GDAL_LIBRARY}.
By using
nm -gC /usr/local/lib/libgdal.so<http://libgdal.so> | grep GDALRasterBand::RasterIO
I got the following output:
00000000009c3360 T GDALRasterBand::RasterIOResampled(GDALRWFlag, int,
int, int, int, void*, int, int, GDALDataType, long long, long long,
GDALRasterIOExtraArg*)
00000000009aaaf0 T GDALRasterBand::RasterIO(GDALRWFlag, int, int, int,
int, void*, int, int, GDALDataType, long long, long long,
GDALRasterIOExtraArg*)
It turns out that the member function GDALRasterBand::RaterIO( ) is
compiled into libgdal.so<http://libgdal.so> with an extra argument with the type of
GDALRasterIOExtraArg*. However, in the file
/usr/local/include/gdal_priv.h, the definition of class GDALRasterBand
shows that the declaration of RasterIO( ) looks like this
CPLErr RasterIO( GDALRWFlag, int, int, int, int, void *, int, int,
GDALDataType, int, int);
Note that the last argument, which is present in the libgdal.so<http://libgdal.so>
implementation, is missing.
Why there is this inconsistency between the header file gdal_priv.h and
the library file libgdal.so<http://libgdal.so>.
Thanks.
Yaoyu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181214/a815b14d/attachment.html>
More information about the gdal-dev
mailing list