-1
自分のコードでmsclrを使用する必要がありますが、msclrも使用する別のクラス「ClassOne」を使用する必要があります。私は 'クラス'型の再定義エラーと基本クラスの未定義エラーを取得します。なぜこれが起こっているのか分かりません。2つの従属クラスでmsclr marshal_cppstdを使用する方法
両方のクラスが同じプロジェクトにあります。 #ClassOne.objを使用するとエラーが表示されます
どうすればこの問題を回避できますか?
ClassOne.h:
#ifndef _CLASSONE_H
#define _CLASSONE_H
ref class ClassOne
{
public:
ClassOne();
};
#endif
ClassOne.cpp:
#include "ClassOne.h"
#include <msclr/marshal_cppstd.h> // For msclr::interop::marshal_as
ClassOne::ClassOne()
{
}
ClassTwo.h:
#ifndef _CLASSTWO_H
#define _CLASSTWO_H
#using "ClassOne.obj"
public ref class ClassTwo
{
public:
ClassOne a;
ClassTwo();
};
#endif
ClassTwo.cpp:
#include "ClassTwo.h"
#include <msclr/marshal_cppstd.h>
ClassTwo::ClassTwo()
{
msclr::interop::marshal_as<std::wstring>(L"text");
}
エラー:
参照のスクリーンショット:Screenshot