Compiler Error C2870

'name' : a namespace definition must appear either at file scope or immediately within another namespace definition

You defined namespace name incorrectly. Namespaces should be defined at file scope (outside all blocks and classes, globally) or immediately within another namespace.

For example, the following code shows namespace A defined in function scope (within a function), which is not allowed:

void main(void) {
   namespace A { int i; }; // error C2870

}