C# C2664无法将*转换为^
我正在使用cocos2dx 3.8在windows 10 UWP中编码,我想使用game sence(CoCoCoS2D,c++)中的xaml调用c++/cx中的函数。 现在呢 错误C2664 “无效 CocosAppWinRT::PayHelper::SetGetPay(CocosAppWinRT::OnStateChanged^)”: 无法将参数 1.从“平台::字符串^* )(无效)转换为“CocosAppWinRT::OnStateChanged^” 错误位置: m_helper->SetGetPay(&OpenGLESPage::GetOnPay) 代码如下:C# C2664无法将*转换为^,c#,c++,cocos2d-x-3.0,C#,C++,Cocos2d X 3.0,我正在使用cocos2dx 3.8在windows 10 UWP中编码,我想使用game sence(CoCoCoS2D,c++)中的xaml调用c++/cx中的函数。 现在呢 错误C2664 “无效 CocosAppWinRT::PayHelper::SetGetPay(CocosAppWinRT::OnStateChanged^)”: 无法将参数 1.从“平台::字符串^* )(无效)转换为“CocosAppWinRT::OnStateChanged^” 错误位置: m_helper->Se
payhelper.h:
public delegate int OnStateChanged();
public ref class PayHelper sealed
{
public:
PayHelper();
int onPay()
{
if (m_getDelegate)
{
return m_getDelegate->Invoke();
}
};
void SetGetPay(OnStateChanged^ del)
{
m_getDelegate = del;
};
private:
property static OnStateChanged^ m_getDelegate;
};
gamesence.h
CocosAppWinRT::PayHelper^ m_payHelper;
m_payHelper = ref new CocosAppWinRT::PayHelper();
m_payHelper->onPay();
OpenGLESPage.xaml.h
private:
PayHelper^ m_helper=nullptr;
public:
int GetOnPay();
cpp
m_helper = ref new PayHelper();
m_helper->SetGetPay(&OpenGLESPage::GetOnPay);
int OpenGLESPage::GetOnPay()
{
return 8;
}
这似乎比C++@jaggedSpire更像是C++/CLI:它不是C++/CLI。正如问题中所解释的,它是C++/CX。