Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C2888
Collapse the table of content
Expand the table of content

Compiler Error C2888

Error Message

'identifier' : symbol cannot be defined within namespace 'namespace'

A symbol belonging to namespace A must be defined in a namespace that encloses A.

The following sample generates C2888:

// C2888.cpp
// compile with: /c
namespace M {
   namespace N {
      void f1();
      void f2();
   }
   
   void N::f1() {}   // OK: namspace M encloses N
}

namespace O {
   void M::N::f2() {}   // C2888 namespace O does not enclose M
}

Community Additions

ADD
Show:
© 2015 Microsoft