Compiler Error C3711


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Compiler Error C3711.

method': an non-managed event source method must return void or an integral type

You defined a method in the event source that did not return void or an integral type. To fix this error, make the event and event handler have a return type of void or an integral type such as int or long.

The following sample generates C3711:

// C3711.cpp  
#include <atlbase.h>  
#include <atlcom.h>  
#include <atlctl.h>  
class CEventSrc {  
   __event float event1();   // C3711  
   // try the following line instead  
   // __event int event1();  
   // also change the handler, below  
class CEventRec {  
   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() {