I use Emacs for development in C. I was trying out some algorithms and I had used some functions from math.h. I had included the header of course. However, when I wanted to compile I knew I would have to use the
my compilation command looked like the following.
-lm
flag to include math.h in the compilation. I use M-x compile
for compilation. It usually asks me to enter the name of the executable to be built. In that same line, I added the CFLAGS=-lm
part to the end of that line and the compilation worked fine. So instead ofmake -k application
my compilation command looked like the following.
make -k application CFLAGS=-lm