使用cocos2dx3.11.1版本在vs2013上编译,出现如下报错:Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
出现错误的代码如下:
void TimerTargetSelector::trigger(float dt)
{
if (_target && _selector)
{
(_target->*_selector)(dt);
}
}
float interval = (_interval > 0) ? _interval : _elapsed;
while (_elapsed >= interval)
{
trigger(interval);
_elapsed -= interval;
_timesExecuted += 1;
if (!_runForever && _timesExecuted > _repeat)
{
cancel();
break;
}
if (_elapsed <= 0.f)
{
break;
}
}