Archived

This topic is now archived and is closed to further replies.

GCC and math.h problem

This topic is 5825 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have just started programming in linux and I am porting some of my software. I need to use the math functions. I was getting errors about "undefined reference sqrt" when compiling with gcc. I thought it was something wrong with my code, so I checked the man pages for ''sqrt'' and made a small test program which has the same error. #include int main () { double test_var; test_var = sqrt(3.00f); return 0; } I used this line to compile the file: gcc -o test test.c I am using Mandrake 8.1, gcc 2.9.6 and glibc 2.2.4 I am I missing something? thanks in advance for any help!

Share this post


Link to post
Share on other sites
make sure the function is declared in "math.h" and that you are binding "glibc" correctly and it contains the "sqrt" function definition.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites