Undefined type error even with forward declaration
问题 I was reading up on circular references and forward declarations. I do understand that it is not a good design practice to have implementations in a header file. However I was experimenting and could not understand this behavior. With the following code (containing the forward declarations) I expected it to build, however I get this error: Error 1 error C2027: use of undefined type 'sample_ns::sample_class2' Header.hpp #ifndef HEADER_HPP #define HEADER_HPP #include "Header2.hpp" namespace