[wx-dev] wxColour strings

Robert Roebling robert at roebling.de
Fri Jun 1 05:36:06 PDT 2007


> VS>    wxPen mypen("blue",1,wxSOLID);
> VS> 
> VS> The error given by gcc is:
> VS> 
> VS>    invalid conversion from ‘const wchar_t*’ to ‘long unsigned int’
> VS>    initializing argument 1 of ‘wxColour::wxColour(long unsigned int)’
> VS> 
> VS> The compiler has to create temporary wxColour instance to pass to 
> VS> wxPen ctor and another temporary wxString in order to be able to call 
> VS> wxColour(wxString) ctor.  Apparently that's too much to ask from a 
> VS> C++ compiler.
> 
>  Yes, because a C++ compiler is not supposed to apply more than one
> user-defined conversion implicitly. However the code like above is very
> common and it's really bad news that it doesn't compile any longer. I'm
> afraid we'll have to provide wxColour ctor overload taking "const char *"
> too.

I think we'll have to add a new constructor to wxPen instead.

  Robert





More information about the wx-dev mailing list