Re: [OT] What is a 'header' file?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Derek Parnell wrote:
> 
> ZNorQ wrote:
> > 
> > I'm not quite sure what a header file is.
> 
> Header files are used by the C and C++ languages. 

<snip>

> Then, when the compiler comes across a reference to an object of the class
> 'Bar',
> it knows enough to check that the reference is valid.
> 
> Header files are useful for single pass compilers because it means that it can
> deal easily with forward references.
> 
> Header files are not needed for multiple pass compilers.

Yeah, but it's a bit more than that, because to build a C/C++ executable,
compiling isn't enough.  Basically, the compiler compiles each .c/cpp/etc
file into an object file, then it links them all together.  Before the linking,
none of the object files really know about each other, except from what
they've heard from header files.  Some of the references might also be
resolved to dynamic/shared libraries.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu