Ошибка компилятора C3707Compiler Error C3707
"функция": метод disp-интерфейса должен иметь DISPID'function' : dispinterface method must have a dispid
При использовании dispinterface
метода его необходимо назначить dispid
.If you use a dispinterface
method, you must assign it a dispid
. Чтобы устранить эту ошибку, назначьте dispid
dispinterface
методу, например, раскомментируйте id
атрибут в методе в примере ниже.To fix this error, assign a dispid
to the dispinterface
method, for example, by uncommenting the id
attribute on the method in the sample below. Дополнительные сведения см. в разделе атрибуты и идентификатор интерфейса .For more information, see the attributes dispinterface and id.
Следующий пример приводит к возникновению ошибки C3707:The following sample generates C3707:
// C3707.cpp
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
[module(name="xx")];
[dispinterface]
__interface IEvents : IDispatch
{
HRESULT event1([in] int i); // C3707
// try the following line instead
// [id(1)] HRESULT event1([in] int i);
};
int main() {
}