‘ClassName’ does not name a type

I have seen similar answers, but I don’t seem to be able to solve mine just by looking at these for example ( this or that one for example).

So, I am having that .



#include <B.h>

using namespace C;

mutable D::DPtr myvariable;  <-- Error in here


In the include B.h I have this :

namespace C{
namespace E{

class D
      typedef share_ptr<D> DPtr;

} //end of namespace E
} // end of namespace C

Why am I getting this error in the mentioned line :

'D'  does not name a type

I am including the .h file, which defines the class. What am I missing?

Source: c++

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.