0

I need create array:

const UInt8 *pixels[3] = { yuvFrame.luma.bytes, yuvFrame.chromaB.bytes, yuvFrame.chromaR.bytes };

But Xcode show me error:

Cannot initialize an array element of type 'const UInt8 *' (aka 'const unsigned char *') with an rvalue of type 'const void *'

I am mixing C++ code with Objective-C. So how can I fix this? I need this const UInt8 *pixels[3]. Any suggestions?

1 Answer 1

1

Try the following initialization

const UInt8 *pixels[3] = 
{ 
    ( const UInt8 * )yuvFrame.luma.bytes, 
    ( const UInt8 * )yuvFrame.chromaB.bytes, 
    ( const UInt8 * )yuvFrame.chromaR.bytes 
};

In C++ there is no implicit conversion from a pointer of type void * to a pointer to an object of any other type.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.