+ 1
What is use of #inlcude ??
I know that include preprocessor directive is used to include header files. But does this also include libraries ?? Or libraries are included by header files being included ?? I'm too much confused. What is exactly use of #inlcude. Because when I searched on Google about including libraries, all of them were explaining how to include header files. Can anyone please explain me that ??
4 ответов
+ 3
#include only operates at the text source file level.
Binary library object files get added by references in the project resources or in the build command line. The linker resolves which modules it ultimately includes in the executable.
+ 2
Generally header files only contain function declarations.
#include directive would simply copy all those declarations and paste it where they are included.
For the definition part, there should only exist one throught the translation unit ( this is known as ODR rule of the language ) thus it's generally kept in seperate binaries which as Brian said are linked later in the build process and have to be explicitly told to your compiler driver to do it.
+ 1
What is the use of library?
0
Libraries like toolbox and functions like tools
We use #include to add toolbox to our code to using tools
So if you consider a large number of libraries, the size of your application will increase