-2

like these are two headers files, now does compiler compiles these ?

#include<iostream.h>
#include<conio.h>
Rushikesh Talokar
  • 1,515
  • 4
  • 16
  • 32
Sahil
  • 1
  • 2
  • 2
    `#include` is basically copy/pasting the contents of the mentioned file into the source file which is then compiled. – Retired Ninja May 30 '21 at 02:26
  • Source files that need to will `#include` those headers (e.g. to use C++ standard I/O streams, it will `#include `) and those source files will be compiled. The preprocessing phase of compilation will substitute the content of each header in place of the `#include` directive, and the compiler will then compile the entire source file. Header files are not normally compiled separately, because they generally contain declarations that are needed by multiple source files and - if compiled alone - don't compile to anything meaningful for a program. – Peter May 30 '21 at 02:29
  • Incidentally, `` has *never* been in standard C++. It existed in some draft standards and older implementations but, in the standardisation process, was replaced by ``. If your compiler/library supports `` (particularly if it doesn't support ``) then it probably dates to mid 1990s or earlier (in comparison, the first C++ standard was ratified in 1998) so it would be advisable to update to a more modern compiler (some are freely available). `` is also non-standard, quite old, vendor-specific, and specific to an obsolete OS. – Peter May 30 '21 at 02:39
  • C and C++ are two distinct and very different languages, don't tag both. – qrdl May 30 '21 at 06:16
  • I guess you are still using [Turbo C++ 3.0](https://stackoverflow.com/questions/44863062) – prapin May 30 '21 at 07:08

2 Answers2

0

When any file is included with an #include directive, the compiler processes its contents as if it were part of the source file being compiled

Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312
-1

actually it depends.

#include mean that: hey compiler would you please copy content of that file inside this file(in preprocessing stage). after compiler copied content to given file then it will go for compiler now it depends. most compiler by default compiler compile given c++ files but other external functions and classes(for example stl and other third party libraries that not yours) will be find during run(which is dynamic library) the other side of dynamic library is static library which is instead of compiler compile specific files it goes for your dependencies and compile them along your code and put them together in this case programme does not need to find libraries during run which is why i said it depend.

more information about compiler stages here.

more information about dynamic library and stl and dynamic library here.

N0ll_Boy
  • 500
  • 3
  • 6