C++/CLI转发声明
C++/CLI forward declarations
我有一个标题如下:
namespace Dummy
{
ref class ISYSession {};
namespace Afw
{
/// <summary>Sammlung von AFW-Utility-Methoden</summary>
public ref class AfwUtility
{
public:
static void CopyAFWParamsToIDictionary(AFWParams ¶meterIn, System::Collections::IDictionary^ parameterOut);
static AFWParams* CopyIDictionaryToAFWParams(System::Collections::IDictionary^ dictionary);
static void ShowExceptionLog(System::String^ sessionId);
static void ShowStatementLog(System::String^ sessionId);
static Dummy::ISYSession^ GetSession(AFWAppClass *acl);
};
}
}
如果我的ref类不使用头,我就不能在同一个程序集中使用它。但是有了这个头,我的代码就不再编译了。
这是前两个错误:
c: \开发。。。\xy.dll:警告C4944:"ISYSession":Das Symbol kann nicht aus"c:\develop。。。\"xy.dll"importiert werden:"Dummy::ISYSession"是Bereich vorhanden的缩写。
(英文:"‘摘要::ISYSession’:无法从xy.dll导入符号:Dummy::ISYSsession已存在于当前作用域中。")
错误C3699:"^":Diese Referenzierung kann nicht für den Typ"Schleupen::CS::SY::ISYSession"verwendet werden。
(英文:"此引用不能用于类型‘Dummy::ISYSession’。")
这是怎么回事?对我来说,编译器似乎认为ISYSession ref类是在同一个程序集中定义的(事实并非如此,它是在不同的.NET DLL中定义的)。
ref class ISYSession {};
这不是正向声明,而是一个没有成员的类的实际类定义。修复:
ref class ISYSession;
相关文章:
- 如何在 C++ 中转发声明 std::set?
- C++使用默认模板参数键入别名和转发声明
- 如何转发声明枚举?
- 使用函数指针转发声明作为 lamba 声明
- 如何将枚举类转发声明为模板化类的内部类?
- 转发声明在命名空间中不起作用的替代方法
- 如何正确转发声明结构"using XXX"?
- 在类内和类外的定义处执行类转发声明是否有区别
- 为什么转发声明的好友类不能在类中引用?
- 如何访问转发声明类的成员
- 仅在标头开发中转发声明
- 无法转发声明C typedef结构-正在查找其他建议
- boost::hana 转发声明标头的用例是什么?
- 循环包含依赖项/转发声明
- c++ 使用复杂的依赖项获取正确的转发声明
- 如何转发声明依赖于变量定义的类,而变体定义又依赖于模板化类?
- 完美转发使用结构化绑定声明的变量
- 如何声明接受转发引用并返回引用或副本的函数模板
- MSVC 在转发类模板声明中阻塞
- 在 cpp 文件中声明转发的类定义,干什么