Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.