Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

round function doesn't exist on Solaris 9?

807559Mar 21 2007 — edited Mar 21 2007
Hello,
The developers in my department have demonstrated that Solaris 9 seems to be missing the round function. I was wondering if you were aware of this, and if anyone has a workaround.

Given this sample source code (round_test.c):
#include <math.h>

int main() {
return round(0.5);
}

We noticed we could not compile on either Solaris 9 or Solaris 10. We get the following error:
sun200:jdavey$ gcc round_test.c
Undefined first referenced
symbol in file
round /var/tmp//ccCDoij8.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

However, we did notice that Solaris 10 has a manpage on round, while Solaris 9 does not. After looking around with Google, we figured out we could get the code to compile on Solaris 10 if we added the -lm directive:
sun209:jdavey$ gcc round_test.c -lm
sun209:jdavey$

But this still doesn't work on Solaris 9, we get the same error as above. Do you have any idea why this is so? I would think the round function to be a pretty standard function.

FYI - we are using gcc 3.3.2 on both versions of Solaris. Thanks,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2007
Added on Mar 21 2007
1 comment
244 views