+ 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 ??

7th Dec 2021, 6:18 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
4 Réponses
+ 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.
7th Dec 2021, 6:45 PM
Brian
Brian - avatar
+ 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.
8th Dec 2021, 1:17 AM
Arsenic
Arsenic - avatar
+ 1
What is the use of library?
8th Dec 2021, 4:01 PM
Vishal Pandey
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
8th Dec 2021, 8:37 AM
Matin Nouri
Matin Nouri - avatar