Enlist wx/string.h header in wx/colour.h

The full `wxString` class definition is needed, not just the forward
declaration. Otherwise the `const char*`- and `const wchar_t*`-based
`wxColour` constructors attempt to call the `Set()` overload that takes
a `unsigned long`, causing the following error:

```
$WXWIN/build-debug/bk-deps g++ -c -o corelib_msw_colour.o         -I$WXWIN/build-debug/lib/wx/include/msw-unicode-static-3.3 -I../include -D_FILE_OFFSET_BITS=64  -D__WXMSW__      -DWXBUILDING -DwxUSE_BASE=0 -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -g -O0     ../src/msw/colour.cpp
In file included from ../src/msw/colour.cpp:14:
../include/wx/msw/colour.h: In constructor 'wxColour::wxColour(const char*)':
../include/wx/colour.h:26:52: error: invalid conversion from 'const char*' to 'long unsigned int' [-fpermissive]
   26 |     wxColour(const char *colourName) { Init(); Set(colourName); }
      |                                                    ^~~~~~~~~~
      |                                                    |
      |                                                    const char*
../include/wx/colour.h:39:5: note: in expansion of macro 'wxWXCOLOUR_CTOR_FROM_CHAR'
   39 |     wxWXCOLOUR_CTOR_FROM_CHAR                                                 \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
../include/wx/msw/colour.h:24:5: note: in expansion of macro 'DEFINE_STD_WXCOLOUR_CONSTRUCTORS'
   24 |     DEFINE_STD_WXCOLOUR_CONSTRUCTORS
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/wx/colour.h:100:28: note:   initializing argument 1 of 'void wxColourBase::Set(long unsigned int)'
  100 |     void Set(unsigned long colRGB)
      |              ~~~~~~~~~~~~~~^~~~~~
../include/wx/msw/colour.h: In constructor 'wxColour::wxColour(const wchar_t*)':
../include/wx/colour.h:40:55: error: invalid conversion from 'const wchar_t*' to 'long unsigned int' [-fpermissive]
   40 |     wxColour(const wchar_t *colourName) { Init(); Set(colourName); }
      |                                                       ^~~~~~~~~~
      |                                                       |
      |                                                       const wchar_t*
../include/wx/msw/colour.h:24:5: note: in expansion of macro 'DEFINE_STD_WXCOLOUR_CONSTRUCTORS'
   24 |     DEFINE_STD_WXCOLOUR_CONSTRUCTORS
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/wx/colour.h:100:28: note:   initializing argument 1 of 'void wxColourBase::Set(long unsigned int)'
  100 |     void Set(unsigned long colRGB)
      |              ~~~~~~~~~~~~~~^~~~~~
make: *** [Makefile:30649: corelib_msw_colour.o] Error 1
```
This commit is contained in:
Tanzinul Islam
2026-05-23 08:51:34 +01:00
committed by Tanzinul Islam
parent 3d179ac15e
commit d1e22202ff
+1
View File
@@ -13,6 +13,7 @@
#include "wx/defs.h"
#include "wx/gdiobj.h"
#include "wx/string.h"
#include "wx/variant.h"
class WXDLLIMPEXP_FWD_CORE wxColour;