Re: Preprocessor, nested files etc.
From: Karl Heinz Buchegger (kbuchegg_at_gascad.at)
Date: 08/13/04
- Next message: IOhannes M zmoelnig: "window-handlers on windows"
- Previous message: Casper: "Re: Tree in C++"
- In reply to: Florian: "Preprocessor, nested files etc."
- Next in thread: Florian: "Re: Preprocessor, nested files etc."
- Reply: Florian: "Re: Preprocessor, nested files etc."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 13 Aug 2004 10:07:43 +0200
Florian wrote:
>
> then those macro definitions don't seem to stick. When the next cpp files is
> being processed, the header file is being included again - even though the
> macro was previously defined
>
> Is this normal, and where am I getting confused?
Each source code file (each *.cpp) is compiled independently of all others.
That's the way things work in C++.
And of course it makes sense. Your project consists of 10 files. The project
I am involved in, consists of more then 400 files. Consider I make a change
in one of them and the compiler is going to recompile everything (sometimes
we have to do this, it takes around 2 hours for a complete recompile).
When the compiler compiles a *.cpp file, it starts in a fresh state. Nothing
it has learned by compiling a previous source code file remains. Which is
a good thing, because it means it can compile a collection of *.cpp files
in any order it likes. If you make a change in one of them, only this file
needs to be recompiled and the linker will form a new executable from the
results of all the copilation steps (they are called 'object files' or 'machine
code files')
-- Karl Heinz Buchegger kbuchegg@gascad.at
- Next message: IOhannes M zmoelnig: "window-handlers on windows"
- Previous message: Casper: "Re: Tree in C++"
- In reply to: Florian: "Preprocessor, nested files etc."
- Next in thread: Florian: "Re: Preprocessor, nested files etc."
- Reply: Florian: "Re: Preprocessor, nested files etc."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|