‘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 .

A.h

#ifnded INCLUDE_CLASS_NAME
#define INCLUDE_CLASS_NAME

#include <B.h>

using namespace C;

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

#endif

In the include B.h I have this :

namespace C{
namespace E{

class D
{
  public:
      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