ubuntuforums-unanswered team mailing list archive
-
ubuntuforums-unanswered team
-
Mailing list archive
-
Message #05107
Re: [Question #77587]: C compiler does not recognize the EXP function even though the program includes math.h
Question #77587 on Ubuntu changed:
https://answers.launchpad.net/ubuntu/+question/77587
George proposed the following answer:
The "-lm" tells the linker to include /usr/lib/libm.so (library), which
provides the code for exp and other functions. Some systems either
include "-lm" in the default compiler flags or put some math functions
in the standard C library because they are commonly needed, but other
systems offer different libraries (e.g., if you want the binary to run
on a system that lacks hardware math functions you need a library that
actually implements functions that might be implemented as simple stubs
that communicate with hardware implementations) so you have to supply
the option to indicate which version you want linked to your program.
--
You received this question notification because you are a member of UF
Unanswered Posts Team, which is an answer contact for Ubuntu.