error C2440: initialization: it's impossible to convert "void" into "RGBTRIPLE."



  • It was a mistake to remembrance under C. Here's the line that the compilation error indicates:

    RGBTRIPLE* StringPixels = malloc((abs(biCopy.biWidth) * sizeof(RGBTRIPLE)));
    

    RGBTRIPLE This is a piccell structure:

    typedef struct
    {
        BYTE rgbtBlue;
        BYTE rgbtGreen;
        BYTE rgbtRed;
    } RGBTRIPLE;
    

    If anyone doesn't understand, I can throw a full code. The code itself is compiling on VS 2012.



  • malloc Repeat the type-indicator void * For subsequent use, it must be clearly identified as appropriate, for example:

    RGBTRIPLE* StringPixels = (RGBTRIPLE*) malloc((abs(biCopy.biWidth) * sizeof(RGBTRIPLE)));
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2