   c++ circular header problems using forward declaration
  HiI''m involved in a rather large coding project, and we''ve run in to trouble.We''ve got a circular set of include-files, and some of the utilizes forward declaration of classes.Now, as we try to define an inheritance (class CPX_InheritObject should inherit class CPX_Object), whom CPX_Object has been previously forwardly declared. The compiler outputs an error message saying "base class undefined".Is there any (valid) way to solve this?The compiler I''m using in Visual Studio.NET 2003 and I''m coding in C++. 
  In order to inherit from an class you can''t have only a forward declaration. However there should be no reason that your base class definition should need the full definition of a derived class, so I fail to see why there''s a circular dependency here. ;  Exactly what SiCrane said.Put declaration of base class into its own header file.  Include this header file where you declare the derived class.Regards,Jeff ;  i went nuts over this very same problem with my project which probably has at least 50 files to it now. I have gotten over the problem by creating a types.h file that i include in just about every other header file in the project. The types file hasclass SomeClass;class SomeOtherClass;. . .declarations for every class that needs a forward declaration. I then include whatever headers are needed for the live code in the .cpp files, and base class headers i just include in the child class header since it will not take a forward declaration. I also include all public enumerations in the types file to keep them all in one place. My compilation is much cleaner now. ;quote:Original post by leiavoia  i went nuts over this very same problem with my project which probably has at least 50 files to it now. I have gotten over the problem by creating a types.h file that i include in just about every other header file in the project.Your compile time must be through the roof  Any change to any of the headers will effectively cause a full rebuild...;  well, no actually. i''m using GNU Make but i do full recompiles every so often to clean house. Weird bugs creep in if i don''t. What''s you''re better idea? Really, i''m open.  