我在 DLL 中创建了一个类(它使用 /clr 运行时,ManagedC++),并在该类中定义了一个构造函数。代码如下:
//Following is defined in something.h//
namespace ABC
{
public ref Class XYZ
{
public: int a;
public: XYZ();
};
//In something.cpp, I've the below code to define the constructor of the class created//
#include something.h
namespace ABC
{
XYZ::XYZ()
{
a = 100;
}
}
上面的项目内置在一个 DLL 中
在另一个项目中,我尝试使用 XYZ 类,如下所示:
#include something.h
using namespace ABC;
//inside main, I've following code
{
ABC::XYZ^ prq = gcnew ABC:XYZ();
prq->a=200;
......
...
}
在这,我得到一个错误说 -
unresolved token (06000001) ABC.XYZ::.ctor
你能帮忙看看这里有什么问题吗?