Compiler Warning (level 4) C4680
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning (level 4) C4680

Error Message

'class' : coclass does not specify a default interface

A default interface was not specified for a class that was marked with the coclass attribute. In order for an object to be useful, it must implement an interface.

The following sample generates C4680:

// C4680.cpp
// compile with: /W4
#include <windows.h>

[ object, uuid(373a1a4c-469b-11d3-a6b0-00c04f79ae8f) ]
__interface IMyIface1
   HRESULT f1();

[ object, uuid(37331a4c-469b-11d3-a6b0-00c04f79ae8f) ]
__interface IMyIface2
   HRESULT f1();

// to resolve C4680, specify a source interface also
// for example, default(IMyIface1, IMyface2)
[ coclass, uuid(373a1a4d-469b-11d3-a6b0-00c04f79ae8f), default(IMyIface1), source(IMyIface1) ]
class CMyClass : public IMyIface1
{   // C4680

int main()
© 2015 Microsoft