c++ - c++基类未定义C2504
问题描述
我有一个继承自 CCommandButton 的类 CConfigButton。我在第 12 行(继承 CCommandButton)遇到基类未定义错误。
错误代码:
Error C2504 'CCommandButton': base class undefined 14
配置按钮.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
命令按钮.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
我已经搜索了其他类似的问题,但一直无法找到解决方案。其他人认为循环依赖是问题的一个可能来源,但我不相信我已经这样做了。我该如何解决?
解决方案
推荐阅读
- c++ - Clang 拒绝编译 libstdc++ 的
标题 - laravel - 我有这个错误 SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where 子句'
- c# - 无法将类型“F_M.Commitment_Ledger_Data__Public_Type”隐式转换为“F_M.Commitment_Ledger_Data__Public_Type[]”
- asp.net-mvc - 在 ASP.NET Core MVC 中记录访问者会话
- javascript - 从日期数组中减去 1 个月
- cqrs - Command Dispatcher 和 Mediator 设计模式有什么区别?
- java - Spring项目-在jsp页面中显示mysql表数据
- django - 如何配置 django_plotly_dash 以从自定义 url 提供资产
- sql - 如何按收入按月返回前 10 家公司
- c# - c# - 拆分带有电子邮件 ID 的字符串会截断电子邮件的最后 3 个字符