Error del compilador C3711

Actualización: noviembre 2007

Mensaje de error

'método': un método de origen de eventos no administrado debe devolver void o un tipo integral
'method': an non-managed event source method must return void or an integral type

Se ha definido un método en el origen de eventos que no devuelve void ni un tipo integral. Para resolver este error, haga que tanto el evento como su controlador tengan un tipo de valor devuelto void o un tipo integral como int o long.

El ejemplo siguiente genera el error C3711:

// C3711.cpp
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>

[event_source(native)]
class CEventSrc {
public:
   __event float event1();   // C3711
   // try the following line instead
   // __event int event1();
   // also change the handler, below
};

[event_receiver(native)]
class CEventRec {
public:
   float handler1() {         // change float to int
      return 0.0;             // change 0.0 to 0
   }
   void HookEvents(CEventSrc* pSrc) {
      __hook(CEventSrc::event1, pSrc, CEventRec::handler1);
   }
   void UnhookEvents(CEventSrc* pSrc) {
      __unhook(CEventSrc::event1, pSrc, CEventRec::handler1);
   }
};

int main() {
}