I was porting from cpp to 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.
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)];
Objective C is a superset of C not C++. static_cast is a C++ operator so Objective C cannot use this.
However there is Objective C++ which does understand C++. To use this rename your .m file to .mm and Xcode will compile this as Objective C++
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With