Austin Benesh | 8 Feb 2007 03:39
Picon

Re: Compiling yafray, error in basictex.cc

Deuss Mario wrote:
>  Hi there,
>
> as I got very interested in the topic of photorealistic rendering and raytracing in a course at my
university, I want
> to take a closer look on yafray. First step would be to compile the source, but I get problems with "line 262
in basictex.cc":
>
> char *ext = strrchr(filename, '.');
>
> I`m compiling it with visual studio 2005, and get the error: 
>
> cl : Command line warning D9035 : option 'Og' has been deprecated and will be re
> moved in a future release
> cl : Command line warning D9002 : ignoring unknown option '/Op'
> basictex.cc
> src\shaders\basictex.cc(262) : error C2440: 'initializing' : cannot convert from
>  'const char *' to 'char *'
>         Conversion loses qualifiers
> scons: *** [src\shaders\basictex.obj] Error 2
> scons: building terminated because of errors.
>
> As I look up a reference on strrchr, this error makes sense, because filename is a const char*:
>
> at http://www.cplusplus.com/reference/clibrary/cstring/strrchr.html, strrchr is declared as following:
>
> const char * strrchr ( const char * str, int character );
>       char * strrchr (       char * str, int character );
>
> I tried to add a const: "const char *ext = strrchr(filename, '.');" but then I get errors with the jpeg_librabry.
>
> To keep it short, I would just be happy, if someone could tell me what to do to get it compiled. 
>
>                thanks, Mario 
>
>
>
> _______________________________________________
> Yafray-devel mailing list
> Yafray-devel <at> nongnu.org
> http://lists.nongnu.org/mailman/listinfo/yafray-devel
>
>   
Try casting filename to char*. Like this:

char *ext = strrchr( (char*) filename, '.');

Gmane