SUNOS 4.0 math library functions

Winston Seah ELESKG%NUSVM.BITNET at cunyvm.cuny.edu
Fri Jun 16 19:41:06 AEST 1989


I am doing some simple simulations using C on a SUN 3/140 running SunOS
4.0.  However, I encountered problems using 'cc'; the loader 'ld' cannot
find the math library (math.h/libm.a) functions, such as log() or exp(),
when I type

    cc -lm -o sim1 sim1.c

The -lm flag is supposed to include the math lib as instructed by the manuals. 
To overcome that I did the following,

    cc -c sim1.c
    ld -lm -o sim1 sim1.o

This went thru, but the image crashed when I executed it - segmentation fault.

I compiled and executed this program on a PC using Turbo C 2.0
successfully.  Am I compiling the program in the right manner? Or have I
missed some critical flags?

Winston Seah
Dept of EE, National University of Singapore
ELESKG at NUSVM.BITNET



More information about the Comp.sys.sun mailing list