【发布时间】:2012-02-02 09:59:22
【问题描述】:
我有一个如下所示的标题:
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:\develop...\xy.dll : 警告 C4944: 'ISYSession' : Das Symbol kann nicht aus 'c:\develop...\xy.dll' importiert werden: 'Dummy::ISYSession' ist bereits im aktuellen Bereich vorhanden。
(english: "'Dummy::ISYSession': 无法从 xy.dll 导入符号: Dummy::ISYSession 已存在于当前范围内。")
错误 C3699: "^": Diese Referenzierung kann nicht für den Typ "Schleupen::CS::SY::ISYSession" verwendet werden。
(英语:“此引用不能用于类型'Dummy::ISYSession'。”)
这应该如何工作?对我来说,编译器似乎认为 ISYSession ref 类是在同一个程序集中定义的(事实并非如此,它是在不同的 .NET DLL 中定义的)。
【问题讨论】:
-
CLI/C++ 是 C++ 的超集。我们应该能够做我们在标准 C++ 中可以做的所有事情。
标签: c++ .net c++-cli forward-declaration