advertisement

Article:
  A Simple Mac OS X libpng Example with OpenGL
Subject:   Type Conversion Compilation Problems
Date:   2007-01-25 11:23:41
From:   Stuey
When I added these pngLoad files to my project I got some compilation errors related to type conversions.


pngLoad.cc: In function 'int pngLoad(char*, long unsigned int**, long unsigned int**, char**)':
pngLoad.cc:130: error: invalid conversion from 'unsigned char*' to 'char*'
pngLoad.cc:145: warning: comparison between signed and unsigned integer expressions
pngLoad.cc:146: error: invalid conversion from 'char*' to 'png_byte*'
make: *** [pngLoad.o] Error 1
make: Target `first' not remade because of errors.


I fixed these by changing the typecast from (unsigned char*) to just (char *). And adding a typecast (png_byte*) on line 146.


But I wonder why this code would work for some people? I suppose it must be a different compiler?


I'm using:
i686-apple-darwin8-gcc-4.0.1


Thanks.