<s>
These	O
included	O
files	O
are	O
called	O
s	O
or	O
copybooks	B-Language
.	O
</s>
<s>
They	O
are	O
often	O
used	O
to	O
define	O
the	O
physical	O
layout	O
of	O
program	O
data	O
,	O
pieces	O
of	O
procedural	O
code	O
,	O
and/or	O
forward	O
declarations	O
while	O
promoting	O
encapsulation	B-Application
and	O
the	O
reuse	O
of	O
code	O
or	O
data	O
.	O
</s>
<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
a	O
header	B-Language
file	I-Language
is	O
a	O
file	O
that	O
allows	O
programmers	O
to	O
separate	O
certain	O
elements	O
of	O
a	O
program	O
's	O
source	O
code	O
into	O
reusable	O
files	O
.	O
</s>
<s>
Header	B-Language
files	I-Language
commonly	O
contain	O
forward	O
declarations	O
of	O
classes	O
,	O
subroutines	O
,	O
variables	O
,	O
and	O
other	O
identifiers	O
.	O
</s>
<s>
Programmers	O
who	O
wish	O
to	O
declare	O
standardized	O
identifiers	O
in	O
more	O
than	O
one	O
source	O
file	O
can	O
place	O
such	O
identifiers	O
in	O
a	O
single	O
header	B-Language
file	I-Language
,	O
which	O
other	O
code	O
can	O
then	O
include	O
whenever	O
the	O
header	O
contents	O
are	O
required	O
.	O
</s>
<s>
This	O
is	O
to	O
keep	O
the	O
interface	O
in	O
the	O
header	O
separate	O
from	O
the	O
implementation	B-Application
.	O
</s>
<s>
The	B-Language
C	I-Language
standard	I-Language
library	I-Language
and	O
the	O
C++	B-Language
standard	I-Language
library	I-Language
traditionally	O
declare	O
their	O
standard	O
functions	O
in	O
header	B-Language
files	I-Language
.	O
</s>
<s>
Some	O
recently	O
created	O
compiled	B-Language
languages	O
(	O
such	O
as	O
Java	B-Language
,	O
C#	B-Application
)	O
do	O
not	O
use	O
forward	O
declarations	O
;	O
identifiers	O
are	O
recognized	O
automatically	O
from	O
source	O
files	O
and	O
read	O
directly	O
from	O
dynamic	B-Application
library	I-Application
symbols	O
.	O
</s>
<s>
This	O
means	O
header	B-Language
files	I-Language
are	O
not	O
needed	O
.	O
</s>
<s>
The	O
include	B-Language
directive	I-Language
allows	O
libraries	B-Library
of	O
code	O
to	O
be	O
developed	O
which	O
help	O
to	O
:	O
</s>
<s>
An	O
example	O
situation	O
which	O
benefits	O
from	O
the	O
use	O
of	O
an	O
include	B-Language
directive	I-Language
is	O
when	O
referring	O
to	O
functions	O
in	O
a	O
different	O
file	O
.	O
</s>
<s>
Suppose	O
there	O
is	O
some	O
C	B-Language
source	O
file	O
containing	O
a	O
function	O
add	O
,	O
which	O
is	O
referred	O
to	O
in	O
a	O
second	O
file	O
by	O
first	O
declaring	O
its	O
external	O
existence	O
and	O
type	O
(	O
with	O
a	O
function	O
prototype	O
)	O
as	O
follows	O
:	O
</s>
<s>
Now	O
,	O
every	O
time	O
the	O
code	O
is	O
compiled	B-Language
,	O
the	O
latest	O
function	O
prototypes	O
in	O
add.h	O
will	O
be	O
included	O
in	O
the	O
files	O
using	O
them	O
,	O
avoiding	O
potential	O
errors	O
.	O
</s>
<s>
In	O
the	O
C	B-Language
and	O
C++	B-Language
programming	I-Language
languages	I-Language
,	O
the	O
#include	O
preprocessor	O
directive	O
causes	O
the	O
compiler	B-Language
to	O
replace	O
that	O
line	O
with	O
the	O
entire	O
text	O
of	O
the	O
contents	O
of	O
the	O
named	O
source	O
file	O
(	O
if	O
included	O
in	O
quotes	O
:	O
""	O
)	O
or	O
named	O
header	O
(	O
if	O
included	O
in	O
angle	O
brackets	O
:	O
)	O
;	O
note	O
that	O
a	O
header	O
does	O
n't	O
need	O
to	O
be	O
a	O
source	O
file	O
.	O
</s>
<s>
Inclusion	O
continues	O
recursively	O
on	O
these	O
included	O
contents	O
,	O
up	O
to	O
an	O
implementation-defined	O
nesting	O
limit	O
.	O
</s>
<s>
Headers	O
need	O
not	O
have	O
names	O
corresponding	O
to	O
files	O
:	O
in	O
C++	B-Language
standard	O
headers	O
are	O
typically	O
identified	O
with	O
words	O
,	O
like	O
"	O
vector	O
"	O
,	O
hence	O
#include	O
<vector>, while in C standard headers have identifiers in the form of filenames with a ".h" extension, as in #include <stdio.h>	O
.	O
</s>
<s>
A	O
"	O
source	O
file	O
"	O
can	O
be	O
any	O
file	O
,	O
with	O
a	O
name	O
of	O
any	O
form	O
,	O
but	O
is	O
most	O
commonly	O
named	O
with	O
a	O
"	O
.h	B-Language
"	O
extension	O
and	O
called	O
a	O
"	O
header	B-Language
file	I-Language
"	O
(	O
sometimes	O
"	O
.hpp	O
"	O
or	O
"	O
.hh	O
"	O
to	O
distinguish	O
C++	B-Language
headers	O
)	O
,	O
though	O
files	O
with	O
.c	B-Language
,	O
.cc	O
,	O
and	O
.cpp	O
extensions	O
may	O
also	O
be	O
included	O
(	O
particularly	O
in	O
the	O
single	B-Language
compilation	I-Language
unit	I-Language
technique	O
)	O
,	O
and	O
sometimes	O
other	O
extensions	O
are	O
used	O
.	O
</s>
<s>
These	O
two	O
forms	O
of	O
#include	O
directive	O
can	O
determine	O
which	O
header	O
or	O
source	O
file	O
to	O
include	O
in	O
an	O
implementation-defined	O
way	O
.	O
</s>
<s>
The	O
fact	O
that	O
headers	O
need	O
not	O
correspond	O
to	O
files	O
is	O
primarily	O
an	O
implementation	B-Application
technicality	O
,	O
and	O
is	O
used	O
to	O
omit	O
the	O
.h	B-Language
extension	O
in	O
including	O
C++	B-Language
standard	O
headers	O
;	O
in	O
common	O
use	O
,	O
"	O
header	O
"	O
means	O
"	O
header	B-Language
file	I-Language
"	O
.	O
</s>
<s>
In	O
C	B-Language
and	O
C++	B-Language
,	O
problems	O
may	O
be	O
faced	O
if	O
two	O
(	O
or	O
more	O
)	O
include	B-Language
files	I-Language
contain	O
the	O
same	O
third	O
file	O
.	O
</s>
<s>
One	O
solution	O
is	O
to	O
avoid	O
include	B-Language
files	I-Language
from	O
including	O
any	O
other	O
files	O
,	O
possibly	O
requiring	O
the	O
programmer	O
to	O
manually	O
add	O
extra	O
include	B-Language
directives	I-Language
to	O
the	O
original	O
file	O
.	O
</s>
<s>
Another	O
solution	O
is	O
to	O
use	O
include	B-Language
guards	I-Language
.	O
</s>
<s>
COBOL	B-Application
(	O
and	O
also	O
RPG	B-Language
IV	I-Language
)	O
allows	O
programmers	O
to	O
copy	O
copybooks	B-Language
into	O
the	O
source	O
of	O
the	O
program	O
in	O
a	O
similar	O
way	O
to	O
header	B-Language
files	I-Language
,	O
but	O
it	O
also	O
allows	O
for	O
the	O
replacement	O
of	O
certain	O
text	O
in	O
them	O
with	O
other	O
text	O
.	O
</s>
<s>
The	O
COBOL	B-Application
keyword	O
for	O
inclusion	O
is	O
COPY	O
,	O
and	O
replacement	O
is	O
done	O
using	O
the	O
REPLACING	O
...	O
BY	O
...	O
clause	O
.	O
</s>
<s>
An	O
include	B-Language
directive	I-Language
has	O
been	O
present	O
in	O
COBOL	B-Application
since	O
COBOL	B-Application
60	O
,	O
but	O
changed	O
from	O
the	O
original	O
INCLUDE	O
to	O
COPY	O
by	O
1968	O
.	O
</s>
<s>
Fortran	B-Application
does	O
not	O
require	O
header	B-Language
files	I-Language
per	O
se	O
.	O
</s>
<s>
However	O
,	O
Fortran	B-Application
90	O
and	O
later	O
have	O
two	O
related	O
features	O
:	O
include	O
statements	O
and	O
modules	B-Architecture
.	O
</s>
<s>
The	O
former	O
can	O
be	O
used	O
to	O
share	O
a	O
common	O
file	O
containing	O
procedure	O
interfaces	O
,	O
much	O
like	O
a	O
C	B-Language
header	I-Language
,	O
although	O
the	O
specification	O
of	O
an	O
interface	O
is	O
not	O
required	O
for	O
all	O
varieties	O
of	O
Fortran	B-Application
procedures	O
.	O
</s>
<s>
This	O
approach	O
is	O
not	O
commonly	O
used	O
;	O
instead	O
,	O
procedures	O
are	O
generally	O
grouped	O
into	O
modules	B-Architecture
that	O
can	O
then	O
be	O
referenced	O
with	O
a	O
use	O
statement	O
within	O
other	O
regions	O
of	O
code	O
.	O
</s>
<s>
For	O
modules	B-Architecture
,	O
header-type	O
interface	O
information	O
is	O
automatically	O
generated	O
by	O
the	O
compiler	B-Language
and	O
typically	O
put	O
into	O
separate	O
module	B-Architecture
files	O
,	O
although	O
some	O
compilers	B-Language
have	O
placed	O
this	O
information	O
directly	O
into	O
object	O
files	O
.	O
</s>
<s>
The	O
language	O
specification	O
itself	O
does	O
not	O
mandate	O
the	O
creation	O
of	O
any	O
extra	O
files	O
,	O
even	O
though	O
module	B-Architecture
procedure	O
interfaces	O
are	O
almost	O
universally	O
propagated	O
in	O
this	O
manner	O
.	O
</s>
<s>
(	O
It	O
has	O
been	O
common	O
practice	O
to	O
name	O
Pascal	B-Application
's	O
include	B-Language
files	I-Language
with	O
the	O
extension	O
.inc	O
,	O
but	O
this	O
is	O
not	O
required	O
.	O
)	O
</s>
<s>
Some	O
compilers	B-Language
,	O
to	O
prevent	O
crock	O
recursion	O
,	O
limit	O
invoking	O
an	O
include	B-Language
file	I-Language
to	O
a	O
certain	O
number	O
,	O
prohibit	O
invoking	O
itself	O
or	O
any	O
currently	O
open	O
file	O
,	O
or	O
are	O
limited	O
to	O
a	O
maximum	O
of	O
one	O
include	B-Language
file	I-Language
at	O
a	O
time	O
,	O
e.g.	O
</s>
<s>
an	O
include	B-Language
file	I-Language
cannot	O
include	O
itself	O
or	O
another	O
file	O
.	O
</s>
<s>
In	O
PHP	B-Application
,	O
the	O
include	B-Language
directive	I-Language
causes	O
another	O
PHP	B-Application
file	O
to	O
be	O
included	O
and	O
evaluated	O
.	O
</s>
<s>
Similar	O
commands	O
are	O
require	O
,	O
which	O
upon	O
failure	O
to	O
include	O
will	O
produce	O
a	O
fatal	B-Error_Name
exception	I-Error_Name
and	O
halt	O
the	O
script	O
,	O
and	O
include_once	O
and	O
require_once	O
,	O
which	O
prevent	O
a	O
file	O
from	O
being	O
included	O
or	O
required	O
again	O
if	O
it	O
has	O
already	O
been	O
included	O
or	O
required	O
,	O
avoiding	O
the	O
C	B-Language
's	O
double	O
inclusion	O
problem	O
.	O
</s>
<s>
There	O
are	O
many	O
forms	O
of	O
the	O
include	B-Language
directive	I-Language
,	O
such	O
as	O
:	O
</s>
<s>
Haskell	B-Language
and	O
Java	B-Language
)	O
tend	O
to	O
avoid	O
copybooks	B-Language
or	O
includes	O
,	O
preferring	O
modules	B-Architecture
and	O
import/export	O
systems	O
for	O
namespace	O
control	O
.	O
</s>
<s>
Some	O
of	O
these	O
languages	O
(	O
such	O
as	O
Java	B-Language
and	O
C#	B-Application
)	O
do	O
not	O
use	O
forward	O
declarations	O
and	O
,	O
instead	O
,	O
identifiers	O
are	O
recognized	O
automatically	O
from	O
source	O
files	O
and	O
read	O
directly	O
from	O
dynamic	B-Application
library	I-Application
symbols	O
(	O
typically	O
referenced	O
with	O
import	O
or	O
using	O
directives	O
)	O
,	O
meaning	O
header	B-Language
files	I-Language
are	O
not	O
needed	O
.	O
</s>
