在my_project.h
前:語法錯誤:缺少';' '^' 在C++託管
#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;
};
在其他文件中一切正常,但在這裏,我做錯了什麼?
ETA:
我已經修改了功能類似這樣:
namespace my_namespace
{
MyManagedClass^ DoSomething(const System::String^ str);
}
,並沒有解決問題,但由於某些原因,如果我改變返回類型爲void
,然後一切工作正常
Foo的定義在哪裏?在vcclr.h? –
@Carlos Quintanilla,在我的例子中'Foo'是'char *' –
你確定錯誤說:''''在'^'之前而不是在'*'之前? –