Sunday 25 May 2014

Compiling in Emacs

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 -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 of

make -k application

my compilation command looked like the following.

make -k application CFLAGS=-lm

No comments: