Compiler Error C3719

Error Message

'interface': an interface based event source can only be used for COM events

You declared an interface in a non-COM context.

The following sample generates C3719:

// C3719a.cpp
#include "atlbase.h"
#include "atlcom.h"

[module(name="MyLibrary", version="1.2", helpfile="MyHelpFile")];

__interface I {
   HRESULT func1();

[event_source(native), coclass]
struct A {
   __event __interface I;   // C3719

   // try the following line instead
   // __event func2();

int main() {

To fix this error, apply the object, coclass, event_source, and event_receiver attributes appropriately to make the classes in which you are using the interface COM classes. For example:

// C3719b.cpp
#include <atlbase.h>
#include <atlcom.h>

[object, uuid("00000000-0000-0000-0000-000000000001")]
__interface I {
   HRESULT f();

[coclass, event_source(com) , uuid("00000000-0000-0000-0000-000000000002")]
struct MyStruct {
   __event __interface I;

struct MyStruct2 {
   void f() {
   MyStruct2(I* pB) {
      __hook(&I::f, pB, &MyStruct2::f);

int main()

Community Additions