Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22016

Why doesn't GCC raise an error when I don't link libm explicitly? [duplicate]

$
0
0

I have referred to the following posts:
Why do you have to link the math library in C?
Why do I have to explicitly link with libm?

All of them suggest I need to link libm explicitly with my program. But I don't get the errors they are getting and my program seems to run fine. I ran ldd on my executable and it doesn't show libm being linked to the program. What's happening?My code:

#include<math.h>#include<stdio.h>void main(){    double a = fabs(-10);    double b = floor(20.12f);    double c = ceil(21.1);    printf("%f,%f,%f",a,b,c);}

Viewing all articles
Browse latest Browse all 22016

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>