#import "G:\WINDOWS\system32\MSCHRT20.OCX" raw_interfaces_only, raw_native_types, no_namespace, named_guids  错误:\mschrt20.tlh(2489) : error C2061: syntax error : identifier 'DataMember'

解决方案 »

  1.   

    In Visual C++ 6.0, a C2061 compiler error occurs when you enclose an initializer in parentheses. To resolve this behavior, enclose the declarator in parentheses or define the declarator as typedef.
      

  2.   

    陌生人,这样回答问题我也会 :)
    编译器错误 C2061语法错误 : 标识符“identifier”编译器在不应有此标识符的地方发现 identifier。初始值设定项可能括在了括号中。为避免该问题,请将声明符括在括号中或使其成为 typedef。在编译器将表达式作为类模板参数检测时也可能导致此错误;使用 typename 告诉编译器它是一个类型。
      

  3.   

    好像需要在#import MSCHRT20.OCX之前包含其它的头文件,这是smart point判断类型的时候出错
      

  4.   

    是否用了using namespace xxx约定空间.还有一种情况,lib中有变量名冲突,如#import “test.lib” no_namespace \
       rename(“OldName”, “NewName”)原因如下
    The rename attribute
    rename("OldName","NewName")OldNameOld name in the type libraryNewNameName to be used instead of the old nameThe rename attribute is used to work around name collision problems. If this attribute is specified, the compiler replaces all occurrences of OldName in a type library with the user-supplied NewName in the resulting header files.This attribute can be used when a name in the type library coincides with a macro definition in the system header files. If this situation is not resolved, then various syntax errors will be generated, such as C2059 and C2061.Note   The replacement is for a name used in the type library, not for a name used in the resulting header file.Here is an example: Suppose a property named MyParent exists in a type library, and a macro GetMyParent is defined in a header file and used before #import. Since GetMyParent is the default name of a wrapper function for the error-handling get property, a name collision will occur. To work around the problem, use the following attribute in the #import statement:rename(“MyParent”,”MyParentX”)which renames the name MyParent in the type library. An attempt to rename the GetMyParent wrapper name will fail:rename(“GetMyParent”,”GetMyParentX”)This is because the name GetMyParent only occurs in the resulting type library header file.
      

  5.   

    你的系统在G盘吗?
    #import "G:\WINDOWS\system32\MSCHRT20.OCX"的路径对不对?