   C++ question
  I want to use a structure from another header as a parameter to a class function.  I have heard that headers shouldn't #include other headers.  How is my compiler supposed to recognize the structure if I can't include other headers in my include file??   
Quote:Original post by jdubI want to use a structure from another header as a parameter to a class function.  I have heard that headers shouldn't #include other headers.  How is my compiler supposed to recognize the structure if I can't include other headers in my include file??Headers are supposed to include other headers; they're just not supposed to do so unnecessarily, or in ways that lead to circular inclusions of other similar problems.What you're probably looking for is a 'forward declaration'. By forward declaring the struct in question, you can reference it without having to include the associated header.Here is a good article that addresses this issue (and other related issues).   ;Quote:Original post by jdubI have heard that headers shouldn't #include other headers.You shouldn't include unnecessary headers.  Some are necessary.   ;Quote:Original post by jdubI have heard that headers shouldn't #include other headers.Headers (and source files) usually have to include headers.However, no files  should include source files (.cpp).   