//AO Include
#pragma warning(push)
#pragma warning(disable : 4192) /* Ignore warnings for types that are duplicated in win32 header files */
#pragma warning(disable : 4146) /* Ignore warnings for use of minus on unsigned types */
#import "esriSystem.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids, exclude("OLE_COLOR", "OLE_HANDLE", "VARTYPE")
#import "esriSystemUI.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "esriGeometry.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "esriDisplay.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "esriOutput.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "esriGeoDatabase.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "esriCarto.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
// Some of the Engine controls
#import "TOCControl.ocx" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "ToolbarControl.ocx" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "MapControl.ocx" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "PageLayoutControl.ocx" raw_interfaces_only, raw_native_types, no_namespace, named_guids
// additionally for 3D controls
#import "esri3DAnalyst.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "esriGlobeCore.olb" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "SceneControl.ocx" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#import "GlobeControl.ocx" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#pragma warning(pop)
编译后出现了'esriControlsMousePointer' : 'enum' type redefinition等类似的五个错误。
这个错误,表示其中一个引入库中存在已经定义了的类型。
第一步,你需要先确定是哪个库导致这个错误。
第二步,在引入错误的库后面做一个声明,表示已经存在的类型来自外部。比如:exclude("OLE_HANDLE", "OLE_COLOR")。
经过上面的处理,你的问题就解决了。
解决的办法是:
把TOCControl.ocx这句的exclude("OLE_COLOR", "OLE_HANDLE", "ICursorPtr", "VARTYPE") 改成 exclude("esriControlsMousePointer","esriControlsDragDropEffect",
"esriControlsDropAction","esriControlsAppearance","esriControlsBorderStyle"),
即:
#import<C:/Program Files/ArcGIS/bin/TOCControl.ocx> raw_interfaces_only raw_native_types no_namespace named_guids exclude("esriControlsMousePointer","esriControlsDragDropEffect",
"esriControlsDropAction","esriControlsAppearance","esriControlsBorderStyle")