Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. COM/ATL trying to write a new interface, getting error base class undefined

COM/ATL trying to write a new interface, getting error base class undefined

Scheduled Pinned Locked Moved COM
c++comhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yoshibebe
    wrote on last edited by
    #1

    I've been trying to add a new interface to my application, and for some reason, I keep getting the following error: C2504: IWWAlmDBAck : base class undefined I defined a new interface in an IDL file, and IWWAlmDBAck is using IUnknown. I declare the interface in a header file, underneath a class called CWWAlmDBPrg, declaring it as public IWWAlmDBAck. The error is pointing to the header file, saying that the base class is undefined. However, there are old interfaces defined under CWWAlmDBPrg, and no errors generated from that. Why is it when I add a new one, the error occur? Below is my header code: This is where I got the error, at IWWAlmDBACK class CWWAlmDBPrg : public IWWAlmDBConnection, public IWWAlmDBInfo, public IWWAlmDBTable, public IWWAlmDBProviderSession, public IWWAlmDBQuery, public IWWAlmDBDetailed, public IWWAlmDBConsolidated, public IWWAlmDBCause, public IWWAlmDBComment, public IWWAlmDBDefaultQuery, public IWWAlmDBTagStatus, public IWWAlmDBEvents, public IWWAlmDBErrorInfo, //New Interface: public IWWAlmDBACK, public CComObjectRoot, public CComCoClass { public: CWWAlmDBPrg() Below is code from my IDL: This is where I defined the interface IWWAlmDBACK: //New [ object, uuid(2D65B748-6B53-45e5-A201-74D072F39045), helpstring("IWWAlmDBACK Interface"), pointer_default(unique) ] interface IWWAlmDBACK : IUnknown { [helpstring("method LogAlmAckConsolidated")] HRESULT LogAlmAckConsolidated([in] int AlarmId,[in,string] wchar_t* AckTime,[in] int AckTimeFracSec,[in] int AckTimeZoneOffset,[in] int AckDaylightAdjustment,[in] int OutstandingAcks,[in] int AckCommentId, [in,string] wchar_t* AckOperatorName,[in,string] wchar_t* AckNodeName, [in] double User1, [in] double User2, [in,string]wchar_t* User3, [in] long Cookie); }; //End New I generated the uuid using guidgen.exe I defined the interface in coclass: coclass WWAlmDBPrg { [default] interface IWWAlmDBConnection; interface IWWAlmDBInfo; interface IWWAlmDBTable; interface IWWAlmDBProviderSession; interface IWWAlmDBQuery; interface IWWAlmDBDetailed; interface IWWAlmDBConsolidated; interface IWWAlmDBCause; interface IWWAlmDBComment; interface IWWAlmDBDefaultQuery; interface IWWAlmDBTagStatus;

    H 1 Reply Last reply
    0
    • Y yoshibebe

      I've been trying to add a new interface to my application, and for some reason, I keep getting the following error: C2504: IWWAlmDBAck : base class undefined I defined a new interface in an IDL file, and IWWAlmDBAck is using IUnknown. I declare the interface in a header file, underneath a class called CWWAlmDBPrg, declaring it as public IWWAlmDBAck. The error is pointing to the header file, saying that the base class is undefined. However, there are old interfaces defined under CWWAlmDBPrg, and no errors generated from that. Why is it when I add a new one, the error occur? Below is my header code: This is where I got the error, at IWWAlmDBACK class CWWAlmDBPrg : public IWWAlmDBConnection, public IWWAlmDBInfo, public IWWAlmDBTable, public IWWAlmDBProviderSession, public IWWAlmDBQuery, public IWWAlmDBDetailed, public IWWAlmDBConsolidated, public IWWAlmDBCause, public IWWAlmDBComment, public IWWAlmDBDefaultQuery, public IWWAlmDBTagStatus, public IWWAlmDBEvents, public IWWAlmDBErrorInfo, //New Interface: public IWWAlmDBACK, public CComObjectRoot, public CComCoClass { public: CWWAlmDBPrg() Below is code from my IDL: This is where I defined the interface IWWAlmDBACK: //New [ object, uuid(2D65B748-6B53-45e5-A201-74D072F39045), helpstring("IWWAlmDBACK Interface"), pointer_default(unique) ] interface IWWAlmDBACK : IUnknown { [helpstring("method LogAlmAckConsolidated")] HRESULT LogAlmAckConsolidated([in] int AlarmId,[in,string] wchar_t* AckTime,[in] int AckTimeFracSec,[in] int AckTimeZoneOffset,[in] int AckDaylightAdjustment,[in] int OutstandingAcks,[in] int AckCommentId, [in,string] wchar_t* AckOperatorName,[in,string] wchar_t* AckNodeName, [in] double User1, [in] double User2, [in,string]wchar_t* User3, [in] long Cookie); }; //End New I generated the uuid using guidgen.exe I defined the interface in coclass: coclass WWAlmDBPrg { [default] interface IWWAlmDBConnection; interface IWWAlmDBInfo; interface IWWAlmDBTable; interface IWWAlmDBProviderSession; interface IWWAlmDBQuery; interface IWWAlmDBDetailed; interface IWWAlmDBConsolidated; interface IWWAlmDBCause; interface IWWAlmDBComment; interface IWWAlmDBDefaultQuery; interface IWWAlmDBTagStatus;

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      The only thing I can think of is to make sure the interface is defined before it is used (i.e., defined before CWWAlmDBPrg) and that the header is included in the source file in which its used. Also, perhaps recompiling the IDL file before building the project would help. I had a similar problem once where the IDL file wasn't getting compiled automatically during the build, and I had to manually do it before the build process.

      Reminiscent of my younger years...

      10 LOAD "SCISSORS" 20 RUN

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups