Skip to Main Content

DevOps, CI/CD and Automation

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!

[SOLVED] undefined reference to fabs

807575Dec 5 2008 — edited Dec 5 2008
Hi folks,

I can't get neither Sunstudio 12 nor SunstudioExpress to work.

I installed SunstudioExpress in a directory of my local account. Then I do the following:
$ cat sun-64.cc
CC_HOME="${HOME}/src/sun-studio-expr-08-11/sunstudioceres"
export PATH="${CC_HOME}/bin:${PATH}"
export MANPATH="${CC_HOME}/man:${MANPATH}"
export LD_LIBRARY_PATH="${CC_HOME}/lib:${LD_LIBRARY_PATH}"

export CC="suncc"
export CXX="sunCC"
export F77="sunf77"
export F90="sunf90"
export F95="sunf95"

$ . sun-64.cc
$ suncc -V
cc: Sun Ceres C 5.10 Linux_i386 2008/10/22
usage: cc [ options] files.  Use 'cc -flags' for details

$ cat fabs-test.c
#include <stdio.h>
#include <math.h>

int main(void)
{
  printf("%d\n", fabs(5.3432));
}

$ suncc -o fabstest fabs-test.c
fabs-test.o: In function `main':
fabs-test.c:(.text+0x17): undefined reference to `fabs'
This also happens with sunstudio 12. Is there some variable I'm missing?

I'm working on a SLES 10 SP1.

Thanks for hints and help,
Thomas

Edit: Excuse the silly question i simply forgot to pass the -lm option to suncc. Other problems also
magically disappeared in the last half an hour.

Edited by: ThomasBach on Dec 5, 2008 5:46 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2009
Added on Dec 5 2008
0 comments
433 views