[computer-go] C++: #include vs .h files

Paul Pogonyshev pogonyshev at gmx.net
Wed Aug 9 15:01:33 PDT 2006


Peter Drake wrote:
> Thanks for the quick response on the array passing. I think I get it  
> now.
> 
> I'm having a devil of a time trying to divide my classes between .h  
> and .cpp files. Specifically, if I have the same #include in  
> several .cpp files, I get complaints about redundant definitions from  
> the linker. I can avoid this by putting everything in the .h files  
> (except for one .cpp file), but then I can't define classes that  
> depend on each other.
> 
> Any advice?

Put everything in each `.h' file into

#ifndef SOME_UNIQUE_FLAG
#define SOME_UNIQUE_FLAG

...

#endif

Putting everything in one `.h' file slows compiling down a lot.  (And
this is already a problem for C++.)

Paul


More information about the computer-go mailing list