在.idl中定义了一个枚举类型
typedef [uuid(...)]
enum {
defaultone = -1,
firstone = 0,
secondone = 1
}ElemEnum;定义一个method,
[id(1), helpstring("method TestMethod")] HRESULT TestMethod([in,optional,defaultvalue(-1)] ElemEnum _param);
编译是错误如下:
error C2440: 'default argument' : cannot convert from 'const int' to 'enum __MIDL___MIDL_itf_DataAdapter_0000_0001'
Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
不知道此处的参数值设为-1有什么不妥的地方,望高手赐教。
typedef [uuid(...)]
enum {
defaultone = -1,
firstone = 0,
secondone = 1
}ElemEnum;定义一个method,
[id(1), helpstring("method TestMethod")] HRESULT TestMethod([in,optional,defaultvalue(-1)] ElemEnum _param);
编译是错误如下:
error C2440: 'default argument' : cannot convert from 'const int' to 'enum __MIDL___MIDL_itf_DataAdapter_0000_0001'
Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
不知道此处的参数值设为-1有什么不妥的地方,望高手赐教。
谢谢楼上的解答!最后会给分的。