QT c++ problems

  • I have a small c++ qt program using this code :```

    //your code here
    ```static uint32_t  * gpioReg = MAP_FAILED;
    uint32_t gpioRead_Bits_0_31(void)
       return (*(gpioReg + GPLEV0));
    the compiler say error which is 
     error: invalid conversion from 'void*' to 'uint32_t* {aka unsigned int*}' [-fpermissive]
    Can someone help me solved this problems??

  • You should also tell from which line the compiler error message comes from...

    It seems that MAP_FAILED is a void pointer, so you should cast it:
    static uint32_t * gpioReg = (uint32_t *)MAP_FAILED;

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.