编译器错误 C2888

“identifier”:不能在命名空间“namespace”中定义符号

属于命名空间 A 的符号必须在包含 A 的命名空间中定义。

以下示例生成 C2888:

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

   void N::f1() {}   // OK: namespace M encloses N
}

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