Libraries in C++

Asked

Viewed 42 times

-1

I have a question about the C++ libraries that are hammering me in time.

Is it really necessary to import for example the Math. h library to use functions like Pow and sqrt? or the locale library. h to use setlocale(LC_ALL,"");?

because today I ended up testing it regardless and it worked the same way, I wonder if it is right to use the functions without caring them and if it causes some "damage" in the program.

From now on, thank you!

  • Yes. It is necessary. And missing something will receive the notice of Missing Ference by LINK and not via generate your program. However many times a #include you use already includes another one you used so it may seem superfluous. If you use a function of b,h and include a.h which incidentally includes b.h you can dispense with the #include "b.h"

1 answer

1


Hello, the correct is to always import the library, sometimes for some reason probably by running with the compiler also running on the machine the code ends up working. But normal behavior causes it to not work and thus harming the project. Therefore I always advise to import the import so that your program always works normally.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.