0

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 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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