[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Gcc compile/linker math



> I can't get gcc to link math functions like cos( ) etc. from
> usr/include/math.h. | mathcalls.h  Box is slink. Any help appreciated.
> TIA.

Try adding -lm to the end of your gcc line:

    gcc -O2 -g -Wall -o prog program.c -lm

This links your program against libm.a.

Chris
-- 
Christopher S. Swingley           tel: 907-474-2689 fax: 474-2643
930 Koyukuk Drive, Suite 408C     email: cswingle@iarc.uaf.edu
University of Alaska Fairbanks    www.frontier.iarc.uaf.edu:8080/
Fairbanks, AK  99775                     ~cswingle

PGP key: http://www.frontier.iarc.uaf.edu:8080/~cswingle/pubkey.asc


Reply to: