Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 652 Bytes

compiler-error-c2870.md

File metadata and controls

23 lines (19 loc) · 652 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Error C2870
Compiler Error C2870
11/04/2016
C2870
C2870
80523ee9-1fd3-4dc4-8a77-5083deb99066

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 must be defined at file scope (outside all blocks and classes) or immediately within another namespace.

The following sample generates C2870:

// C2870.cpp
// compile with: /c
int main() {
   namespace A { int i; };   // C2870
}