[therion] problem compiling on debian woody

Olly Betts olly at survex.com
Tue Jan 18 01:50:42 CET 2005


On Tue, Jan 18, 2005 at 12:45:09AM +0100, Roman Mu?oz wrote:

>> thparse.cxx:756: implicit declaration of function `int round(...)'
>> make: *** [thparse.o] Error 1


round() was added to ISO C in the 1999 revision of the standard, which
can make it tricky to call from C++ currently (ISO C++ includes the C89
library functions, but not those added in C99 so these currently live in
a strange no man's land).  Actually, now I think about it, I'm not sure
the compiler in woody supports round() even in C code.

Anyway, the simplest solution is probably just to stick your own
implementation of round near the top of any file which wants it (looks
like thparse.cxx is the only one actually).  Adding it just after the
#include lines is safest:

static inline double
round(double x) {
    if (x >= 0.0) return floor(x + 0.5);
    return ceil(x - 0.5);
}

Cheers,
    Olly





More information about the Therion mailing list