Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.