在my_project.h
:
#pragma once
#include <vcclr.h>
#include "MyManagedClass.h"
namespace my_namespace
{
MyManagedClass^ DoSomething(const Foo* foo);
}
我有下一个错误:
1) error C2143: syntax error : missing ';' before '^'
2) error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
项目已创建为c++/cli
.
在"MyManagedClass.h"
:
public ref class MyManagedClass
{
public:
System::UInt32 GetMember()
{
return m_member;
}
private:
System::UInt32 m_member;
};
在其他文件中一切正常,但在这里,我做错了什么?
预计到达时间:
我已经像这样修改了函数:
namespace my_namespace
{
MyManagedClass^ DoSomething(const System::String^ str);
}
它并没有解决问题,但由于某种原因,如果我将返回类型更改为void
,那么一切正常