本文介绍了错误:static_cast 未声明 -> 目标 C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从 cpp 移植到 Objective C.
I was porting from cpp to Objective C.
目标 C:
[pPacket SetHeaderSequenceNumber:static_cast<char>(m_transmitSequenceNumber + ASCII_ZERO)];
cpp:
pPacket->SetHeaderSequenceNumber(static_cast <char>(m_transmitSequenceNumber + ASCII_ZERO));
error:static_cast 未声明.
error:static_cast undeclared.
推荐答案
objective-c 是 c 的超集,而不是 c++,因此它不支持 static_cast.你可以只使用 c-style cast:
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)];
这篇关于错误:static_cast 未声明 -> 目标 C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!