相关文章推荐
老实的烈酒  ·  MacOS 10.15.x 最新安装 ...·  1 年前    · 
完美的硬盘  ·  Angular:ERROR in ...·  1 年前    · 
路过的小熊猫  ·  2018-06-25 ...·  1 年前    · 

语法错误: 标识符“identifier”

编译器找到了一个意外标识符。 请确保 identifier 在使用之前已声明。

初始值设定项可能由括号括起来。 若要避免此问题,请将声明符括在括号中或让其成为 typedef

当编译器将表达式检测为类模板参数时,也可能导致此错误;使用 typename 告知编译器它是一种类型。

下面的示例生成 C2061:

// C2061.cpp
// compile with: /c
template < A a >   // C2061
// try the following line instead
// template < typename b >
class c{};

如果将实例名称传递给 typeid,则可能会出现 C2061:

// C2061b.cpp
// compile with: /clr
ref struct G {
   int i;
int main() {
   G ^ pG = gcnew G;
   System::Type ^ pType = typeid<pG>;   // C2061
   System::Type ^ pType2 = typeid<G>;   // OK