I have recently installed ubuntu 12.04 LTS 32 bit desktop version and I wrote a computer program where it uses the math.h head, and I keep getting an error saying that it is an undefined reference to 'pow'. I compliled it using gcc -Wall -lm filex.c -o filex.out
.
I really like this new system but what can be going wrong? All forums I have looked at just say to compile using -lm
which I am. I have compiled the same program in another computer and it works just fine. Can someone help?
1 Answer
I met a same problem, and found your question by search engine. I solve the problem by moving the option "-lm" to the last part of the command.
Please try the following command:
gcc -Wall filex.c -o filex.out -lm