Opened 8 weeks ago

Closed 8 weeks ago

#16391 closed defect (fixed)

wxCustomBackgroundWindow lacks headers it depends on

Reported by: SasQ_pl Owned by: VZ
Priority: normal Milestone:
Component: base Version: 3.0.0
Keywords: wxCustomBackgroundWindow, header Cc:
Blocked By: Blocking:
Patch: yes

Description

When #include <wx/custombgwin.h> is the first header on the list, it floods with compile errors about incomplete types from wxWdigets library. When I peeked into this header, I discovered that it doesn't include any wxWidgets headers which would define the symbols it uses. Those symbols are, in order they occur in the source:

wx/custombgwin.h:
wxBitmap                   // #include <wx/bitmap.h>
wxDECLARE_NO_COPY_CLASS    // #include <wx/defs.h>

wx/generic/custombgwin.h:
wxEraseEvent               // #include <wx/event.h>
wxWindow                   // #include <wx/window.h>
wxDC                       // #include <wx/dc.h>
wxSize                     // #include <wx/gdicmn.h>

Depending on the order the user includes the file, or requiring him to include some other header first, is considered bad style coding. The problem can be solved by including the required headers at the top of the header in question. I tried to add the above list of headers inside the library headers and it solved the problem, no more strange errors from the wxWidgets library.

Change History (1)

comment:1 Changed 8 weeks ago by VZ

  • Owner set to VZ
  • Resolution set to fixed
  • Status changed from new to closed

In 76947:

Include the required headers from wx/custombgwin.h.

Make this header self-contained, i.e. safe to include as the first wxWidgets
header being included from the user code.

Closes #16391.

Note: See TracTickets for help on using tickets.