请教Compiler Error C2061的分析
以下摘自MSDN。我没有太看明白,不知道哪位能帮忙解释一下。另外,我的实际问题是在定义一个接口的时候,用到一个其他文件中的结构体(我的接口中定义了一个使用该结构体的函数,参数类型是该结构体的指针)。我没有包含该文件,于是出现该错误。但是这样为什么呢?
Compiler Error C2061
syntax error : identifier 'identifier'
The compiler found identifier where it was not expected. This error can be caused by enclosing an initializer in parentheses. The error can be avoided by enclosing the declarator in parentheses or making it a typedef. The following example causes this error and shows two fixes:
class X {};
class Y {};
class Z {};
class W : public X, public Y, public Z {};
void func ( W* pW )
{
X* pX ( pW ); // Error: unexpected identifier 'pW'
Y ( *pY ) ( pW ); // OK, declarator in parentheses
typedef Z *pZ_t;
pZ_t pZ ( pW ); // OK, typedef used for Z
}