I am trying to use the math function round() according to the manpage, but it does not compile. Can anyone explain why not, please?
This is a C++ app compiled with g++-2.95 (because the target is a Sharp Zaurus). According to man 3 round: NAME round, roundf, roundl - round to nearest integer, away from zero SYNOPSIS #include <math.h> double round(double x); float roundf(float x); long double roundl(long double x); Compile with -std=c99; link with -lm. The code is: class OrderImpl : public OrderForm { ... double discpc; ... void calculate_line(int); ... }; #include <math.h> ... void OrderImpl::calculate_line(int newqty) { double price = atof(TextLabelPrice->text()); char tmp[20]; sprintf(tmp, "%.4f", round((double) newqty * price * discpc) / 100.); ... } The command line and error are: g++-2.95 -c -pipe -DQWS -fexceptions -fno-rtti -Wall -W -g -std=c99 -I/opt/Qtopia/include -o orderimpl.o orderimpl.cpp orderimpl.cpp: In method `void OrderImpl::calculate_line(int)': orderimpl.cpp:84: implicit declaration of function `int round(...)' -- Oliver Elphick olly@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA ======================================== Do you want to know God? http://www.lfix.co.uk/knowing_god.html -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]