System V C Math Routines

djmolny at cuae2.UUCP djmolny at cuae2.UUCP
Wed Oct 22 23:24:43 AEST 1986


>     Has anyone out there had any trouble using the Math library from AT&T
>C language on a 3B(5)?  I #include math.h and the linker complains (as it
>should) when I cc.  Then I compile without linking and link separatly while
>including the library libm.a (-lm) and it still complains.  My program is a
>simple test that uses the sin() and cos() functions, but these are always
>said to be undefined by the linker.  I even tried to link the library's
>filename explicitly, copied it into a file called math.o and linked that
>explicitly (all the while making sure to link the C library).  No luck.
>How is one supposed to use the math routines from C?  I know that I'm
>labeling myself as a novice, but darn it I can't get anything to work.
>

...

The math library definitely works correctly on the 3B5.  Be sure the
-lm option is the last thing on the command line when you link, and
be sure to use the -f option as well.  An example:

	cc -f -o simple simple.c -lm

If you can't get this to work, send me a copy of your source file
and the *exact* error messages you get, and I will take a look at it.




-- 
						Regards,
						DJ Molny
						N9609U
						ihnp4!cuae2!djmolny



More information about the Comp.unix mailing list