Re: New to gcc: missing sin/cos
On Sun, Dec 05, 1999 at 09:09:14PM -0600, Brian G. Neal wrote:
> I am trying to port some C code from Windows (i.e. no
> makefile) and I am using gcc for the first time.
> One of the files has some sin() and cos() calls
> in it. And yes it includes math.h. If I do a:
>
> % gcc -o main main.c file1.c file2.c
>
> I get some error messages about not finding sin and cos.
>
> I assume I need to include some library that has sin/cos.
> I found the -l switch to pass libraries to the linker but
> I have no idea what library to use. Am I missing something
> obvious here?
You have to use -lm. Why the system is still set up that way, I can only
ponder. After all, the math library is part of ISO/ANSI C.
--
+----------------------------------------------------+
| Eric G. Miller egm2@jps.net |
| GnuPG public key: http://www.jps.net/egm2/gpg.asc |
+----------------------------------------------------+
Reply to: