Author Topic: wxPaintDC has initializer but incomplete type  (Read 3100 times)

Offline phmb23

  • Single posting newcomer
  • *
  • Posts: 3
wxPaintDC has initializer but incomplete type
« on: July 11, 2014, 11:57:14 pm »
I am new to Code::Blocks and am trying to reproduce an example from the wxSmith tutorial (http://wiki.codeblocks.org/index.php?title=WxSmith_tutorial:_Creating_items_with_custom_paint_and_mouse_handling).

when I compile the program, I get a fatal error:
|116|error: variable 'wxPaintDC dc' has initializer but incomplete type|
  the code referred to is:

void PAintexperimentFrame::OnPanel1Paint(wxPaintEvent& event)
{
    wxPaintDC dc(Panel1);
    dc.drawLine(0,0,100,100);
}

Can anyone help me?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6644
    • My Best Post
Re: wxPaintDC has initializer but incomplete type
« Reply #1 on: July 12, 2014, 12:04:10 am »
Add the line to include the needed header.

This is the likely missing line.
Code: [Select]
#include <wx/dcclient.h>

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline phmb23

  • Single posting newcomer
  • *
  • Posts: 3
Re: wxPaintDC has initializer but incomplete type
« Reply #2 on: July 12, 2014, 12:13:28 am »
Thanks that solved the problem.