2016年5月31日 星期二

0531 在標頭檔宣告 static_cast dynameic_case 出錯

http://stackoverflow.com/questions/6031054/errorstatic-cast-undeclared-objective-c

error:static_cast undeclared->Objective C

Objective C:
[pPacket SetHeaderSequenceNumber:static_cast<char>(m_transmitSequenceNumber + ASCII_ZERO)];
cpp:
pPacket->SetHeaderSequenceNumber(static_cast <char>(m_transmitSequenceNumber + ASCII_ZERO));
error:static_cast undeclared.


改採用C
objective-c is a superset of c, not c++ so static_cast is not supported in it. You can just use c-style cast:
[pPacket SetHeaderSequenceNumber:(char)(m_transmitSequenceNumber + ASCII_ZERO)];

沒有留言:

張貼留言

cocos2dx-lua 建立滑鼠監聽

重要關鍵字  EVENT_MOUSE_SCROLL addEventListenerWithSceneGraphPriority      if IsPc() then --建立滑鼠監聽         local listener = cc.EventListenerMouse...