[GRASS-dev] i.landsat.toar clang compilation fails due to inline

Vaclav Petras wenzeslaus at gmail.com
Sat Oct 19 20:46:46 PDT 2013


Hi,

i.landsat.toar compilation fails when compiling using clang compiler. The
error is:

 undefined reference to `date_replace_slash'

This function is defined using ``inline`` keyword:

 inline void date_replace_slash(char *str)

I know ``inline`` is not part of C89. However, I'm not sure about the fix.
I can fix it by replacing ``inline`` by ``__inline__``. This works for GCC
[1] and clang (should support GCC extensions) but I'm not sure about other
compilers (on the less usual platforms).

Moreover, I actually don't know how what causes the error in the first
place.

Alternative fixes are macro but I would just do the normal function and
hope for compiler optimization.

Note that the function should be probably static.

Vaclav

[1] http://gcc.gnu.org/onlinedocs/gcc/Inline.html


Log:
: && clang -L.../dist.i686-pc-linux-gnu/lib
-L.../dist.i686-pc-linux-gnu/lib -Wl,--export-dynamic
-Wl,-rpath-link,.../dist.i686-pc-linux-gnu/lib  -o
.../dist.i686-pc-linux-gnu/bin/i.landsat.toar
OBJ.i686-pc-linux-gnu/earth_sun.o OBJ.i686-pc-linux-gnu/landsat.o
OBJ.i686-pc-linux-gnu/landsat_met.o OBJ.i686-pc-linux-gnu/landsat_set.o
OBJ.i686-pc-linux-gnu/main.o    -lgrass_raster.7.0.svn -lgrass_gis.7.0.svn
 -lm
OBJ.i686-pc-linux-gnu/landsat_met.o: In function `lsat_metadata':
.../imagery/i.landsat.toar/landsat_met.c:124: undefined reference to
`date_replace_slash'
.../imagery/i.landsat.toar/landsat_met.c:138: undefined reference to
`date_replace_slash'
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20131019/ed35208d/attachment.html>


More information about the grass-dev mailing list