problem compiling on debian woody
Hi, this is my first post I'm trying to compile in debian woody with Tcl/Tk8.4 from www.backports.org. BWidget is 1.3 from woody. Tkimg is compiled from source. This is what I am getting: tatel@ganbo:~/src/therion$ make g++ -c -Wall -DTHLINUX -O2 -o thdate.o thdate.cxx g++ -c -Wall -DTHLINUX -O2 -o thexception.o thexception.cxx g++ -c -Wall -DTHLINUX -O2 -o thbuffer.o thbuffer.cxx g++ -c -Wall -DTHLINUX -O2 -o thmbuffer.o thmbuffer.cxx g++ -c -Wall -DTHLINUX -O2 -o thlogfile.o thlogfile.cxx g++ -c -Wall -DTHLINUX -O2 -o thtmpdir.o thtmpdir.cxx g++ -c -Wall -DTHLINUX -O2 -o thparse.o thparse.cxx thparse.cxx: In function `void thparse_image(char *, double &, double &, double &)': thparse.cxx:756: implicit declaration of function `int round(...)' make: *** [thparse.o] Error 1 What should I do? Thanks, Roman
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
Hi again, It worked like a charm Many thanks, Roman On Tue, 18 Jan 2005 00:50:42 +0000 Olly Betts <olly@survex.com> wrote:
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
participants (2)
-
Olly Betts -
Roman Muñoz