   Wow recursive includes?
  Didn't know this was possible, //foo.h#include "foo.h"how come there is no compile time error saying that there is a circularly linkageproblem or something? Is it because of how linkage works? error :fatal error C1014: too many include files : depth = 1024
  Whaaaat? I don't get it. You post some code saying you didn't know it was possible, then post the error. That error is basically saying yes, there is a circular including issue, and it pretty clearly shows that if you read it. As for how including works, other people can answer that, although I'm sure it's on msdn.   ;Quote:Original post by Concentratehow come there is no compile time error saying that there is a circularly linkageproblem or something? Is it because of how linkage works? Linkage has nothing to do with include files. The C preprocessor.;  It's got nothing to do with linkage...this is all pre-processor stuff.when you #include a file it get's copied into the file it's being #included from..so...if foo.h #includes foo.h ...then that will #include foo.h...which will also #include foo.h which will also #include foo.h...which will also...and so on etc.Why you would want to do this is anybodys guess...   ;  Yann L beat me to it...but learn these things...1. Pre-processor2. Compilation3. LinkageIt's not rocket science...;  Much more interesting is this case://File A.h#include "B.h"SomeClassFromB TestB;//File B.h#include "A.h"SomeClassFromA TestA;There you have to work with predefines, some #pragma once and/or some preprocessor stuff to get it working.(Still trying to imagine how a recursive include could make sense...);  I did not do that on purpose. It was by mistake.   ;Quote:Original post by mind in a box(Still trying to imagine how a recursive include could make sense...)There are elements of Boost which use recursive includes to expand fancy preprocessor/template constructs... I would not however suggest than any person wishing to retain their sanity use this technique in their own code [smile]   ;  What Swiftcoder said...it makes my eyes bleed just thinking about it :);  Could be a good time to learn about include guards.At the top of every header add#ifndef YOURCLASSNAME_H#define YOURCLASSNAME_H//everything else..#endif