Question

in C why do you had to compile the code with the flag -lm at the...

in C why do you had to compile the code with the

flag -lm

at the end. Why is it and what does this flag indicate?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

-l is used to link static library

-l<library name>

Reason for adding -lm because m stands for math library which is already provided by C compiler and -l is used to link that library so that we can access common math functions like pow (power) , sin (Sine of angle) etc

Hence -lm flag is used.

Similary lets say we have created a library name with name as util , so we can use -lutil to link our library


PLEASE COMMENT if there is any concern/doubts

Add a comment
Know the answer?
Add Answer to:
in C why do you had to compile the code with the flag -lm at the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT