C++/CLI前向声明

Ant*_*ino 2 .net c++ c++-cli forward-declaration

我的标题看起来像这样:

    namespace Dummy
    {
        ref class ISYSession {};

        namespace Afw
        {
            /// <summary>Sammlung von AFW-Utility-Methoden</summary>
            public ref class AfwUtility
            {
            public:
                static void CopyAFWParamsToIDictionary(AFWParams &parameterIn, 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);
            };
        }
    }
Run Code Online (Sandbox Code Playgroud)

如果我不使用我的ref类的标题,我不能在同一个程序集中使用它.但是使用这个头文件我的代码不再编译了.

这是前两个错误:

c:\ develop ...\xy.dll:警告C4944:'ISYSession':Das Symbol kann nicht aus'c:\ develop ...\xy.dll'importiert werden:'Dummy :: ISYSession'isre bereits im aktuellen Bereich vorhanden.

(英语:"'Dummy :: ISYSession':无法从xy.dll导入符号:Dummy :: ISYSession已存在于当前范围内.")

错误C3699:"^":Diese Referenzierung kannnichtfürdenTyp"Schleupen :: CS :: SY :: ISYSession"verwendet werden.

(英语:"此引用不能用于Type'Dummy :: ISYSession'.")

这应该怎么样?对我来说,似乎编译器认为ISYSession ref类是在同一个程序集中定义的(它不是,它在不同的.NET DLL中定义).

Han*_*ant 10

    ref class ISYSession {};
Run Code Online (Sandbox Code Playgroud)

这不是前向声明,这是没有成员的类的实际类定义.固定:

    ref class ISYSession;
Run Code Online (Sandbox Code Playgroud)