I am trying to reuse code from another project, but while copying the classes over, it generated a compiler error in the new project, but while it was in the other project, it worked just fine.
The error is
Cannot initialize a parameter of type 'const uint8_t *' (aka 'const unsigned char *') with an rvalue of type 'const void *'
and the code is
[outputStream write:[userdata bytes] maxLength:[userdata length]];
outputStream is an NSOutputStream, and userdata is an NSData object. The same code surrounding this statement is used in both projects.
Both projects are compiling for the same target OS( iOS 5.0) and archetecture(armv7), and both have identical frameworks added.
I also tried to clean the project, and build it again. Same problem.
Any help would be appreciated.
In the end, this was solved by casting:
[outputStream write:(const uint8_t *)[userdata bytes] maxLength:[userdata length]];
followed by a clean and build (without cleaning, it would come up with a different error.)
I'm guessing that the old project is using the GCC compiler, and the new project is using LLVM. So the error is coming from the Clang front-end. If you change your compiler to GCC or LLVM GCC, it should go away.
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