C# 指定的函数与委托类型';无效(void)和#x27;

C# 指定的函数与委托类型';无效(void)和#x27;,c#,visual-c++,interop,marshalling,C#,Visual C++,Interop,Marshalling,指定的函数与委托类型“void(void)”D:\westside\NetSockets\win32project\Win32.cpp 70 1 win32project不匹配 简而言之,win32应用程序使用C#库。当win32应用程序调用C#库中的构造函数方法时,就会出现上述错误。下面是代码。我不确定我错过了什么 win32应用程序代码 void ServerClass::ActionMethod(int iCommand, int iClientIndex, System::String^

指定的函数与委托类型“void(void)”D:\westside\NetSockets\win32project\Win32.cpp 70 1 win32project不匹配

简而言之,win32应用程序使用C#库。当win32应用程序调用C#库中的构造函数方法时,就会出现上述错误。下面是代码。我不确定我错过了什么

win32应用程序代码

void ServerClass::ActionMethod(int iCommand, int iClientIndex, System::String^ message)
{

}

void ServerClass::StartServer()
{   
server = gcnew NetSockets::NetSocket(gcnew System::Action(this, &ServerClass::ActionMethod1));
}
头文件

Error C3352: 'void ServerClass::ActionMethod(int,int,System::String ^)' : 
源文件

public ref class ServerClass
{
NetEvents::NetEventArgs^ args;
NetSockets::NetSocket^ server;
public:
void ActionMethod(int iCommand, int iClientIndex, System::String^ message);
void StartServer();
};
C#库代码

void ServerClass::ActionMethod(int iCommand, int iClientIndex, System::String^ message)
{

}

void ServerClass::StartServer()
{   
server = gcnew NetSockets::NetSocket(gcnew System::Action(this, &ServerClass::ActionMethod1));
}
名称空间NetSockets
{
公共类NetSocket
{
客户行动;
公共NetSocket(操作)
{
}
公共NetSocket(操作)
{
this.actClient=操作;
}
}
}

系统.Action委托是一种委托类型,没有返回void的参数

正如错误消息所说,您的函数与此不匹配


你需要使用不同的委托类型,例如
操作

史蒂夫:没有人会直接给你发电子邮件。你必须在这里检查。可能是