C ++基类未定义C2504

时间:2019-07-10 14:50:22

标签: c++ inheritance

我有一个CConfigButton类,该类继承自CCommandButton。我在第12行(继承CCommandButton)遇到基类未定义的错误。

错误代码:

Error   C2504   'CCommandButton': base class undefined  14  

ConfigButton.h

#pragma once

#ifndef CONFIG_BUTTON_H
#define CONFIG_BUTTON_H

class CConfigButton;

#include "Resource.h"
#include "CommandButton.h"



class CConfigButton :
   public CCommandButton {
public:
   //----- ButtonDefinitionSink
   STDMETHOD(ButtonDefinitionEvents_OnExecute) (NameValueMap *pContext);

};

#endif // !CONFIG_BUTTON_H

CommandButton.h

#pragma once

#ifndef COMMAND_BUTTON_H
#define COMMAND_BUTTON_H



#include "Resource.h"
#include "swentylFRCAddinAddInServer.h"

class ATL_NO_VTABLE CCommandButton;

//class CCommandButton;
// CCommandButton

class ATL_NO_VTABLE CCommandButton :
   public CComObjectRootEx<CComSingleThreadModel>,
   public IDispEventImpl<0, CCommandButton, &DIID_ButtonDefinitionSink, &LIBID_Inventor, 1, 0>
{

protected:
   //Inventor application object
   CComPtr<Application> m_pApplication;

   //Command button definition
   CComPtr<ButtonDefinitionObject> m_pCommandButtonDef;

public:
   CCommandButton()
   {
      m_pApplication = NULL;
      m_pCommandButtonDef = NULL;
   }

   DECLARE_NO_REGISTRY()

   BEGIN_COM_MAP(CCommandButton)
   END_COM_MAP()

   BEGIN_SINK_MAP(CCommandButton)
      SINK_ENTRY_EX(0, DIID_ButtonDefinitionSink, ButtonDefinitionSink_OnExecuteMeth, ButtonDefinitionEvents_OnExecute)
   END_SINK_MAP()

public:
   //----- ButtonDefinitionSink
   STDMETHOD(ButtonDefinitionEvents_OnExecute) (NameValueMap *pContext) = 0;

   HRESULT CreateButtonDefinition(Application* pApplication,
      BSTR bstrDisplayName,
      BSTR bstrInternalName,
      CommandTypesEnum eCommandType,
      VARIANT varClientId,
      BSTR bstrDescription,
      BSTR bstrToolTip,
      int StandardIconResId,
      int LargeIconResId,
      ButtonDisplayEnum eButtonDisplayType,
      ButtonDefinitionObject** pCommandButtonDefinition);

   HRESULT GetButtonDefinition(ButtonDefinitionObject** pCommandButtonDef);

   HRESULT Disconnect();
};

#endif // !COMMAND_BUTTON_H

我已经搜索了其他类似的问题,但是还没有找到解决方案。其他人则认为,循环依赖是导致此问题的一个可能原因,但我不认为我已经做到了。我该如何解决?

0 个答案:

没有答案