Error[Pe513]: a value of type "void *" cannot be assigned to an entity of type "uint8_t *"

17,724

C allows implicit conversions to/from void*, which C++ does not. You need to cast to the correct type.

Use:

uint8_t *pNextRam;
pNextRam = (uint8_t*)RAM32Boundary;// load up the base ram

Or better still*, use a C++ style cast instead of C style.:

uint8_t *pNextRam;
pNextRam = static_cast<uint8_t*>(RAM32Boundary);// load up the base ram

*In practice, casting is an easy source of bugs. C++ style casts allow a reader of your code to easily see a cast and allow the compiler to enforce the correctness of your cast.

Share:
17,724
andre
Author by

andre

11.71875 is the a hardware manufacturers dozen.

Updated on June 29, 2022

Comments

  • andre
    andre almost 2 years

    I am attempting to convert a C project into C++.

    In the C project I countered this error while compiling into c++:

    Error[Pe513]: a value of type "void *" cannot be assigned to an entity of type "uint8_t *"

    The following code gives this error:

    #define RAM32Boundary  0x20007D00
    uint8_t *pNextRam;
    pNextRam = (void*)RAM32Boundary;// load up the base ram
    

    Can anyone explain what this is doing in C and how to convert it into C++?