Search code examples
c++wxwidgets

error: ‘virtual bool wxTopLevelWindowGTK::Show(bool)’ is inaccessible


I am trying to compile wxWidgets first example command-line, And getting following error

/usr/local/include/wx-3.0/wx/gtk/toplevel.h: In member function ‘virtual bool MyApp::OnInit()’:
/usr/local/include/wx-3.0/wx/gtk/toplevel.h:63:18: error: ‘virtual bool wxTopLevelWindowGTK::Show(bool)’ is inaccessible
     virtual bool Show(bool show = true);
                  ^
app1.cpp:36:19: error: within this context
   frame->Show(true);
                   ^
app1.cpp:36:19: error: ‘wxTopLevelWindowGTK’ is not an accessible base of ‘MyFrame’

I am using command line to compile program

g++ -v `wx-config --version=3.0 --cxxflags` -std=c++11 `wx-config --version=3.0 --libs` app1.cpp

and getting following error log : Error Log

Complete Code: Source Code


Solution

  • class MyFrame : wxFrame
    

    should be

    class MyFrame : public wxFrame
    

    By default class inheritence is private. In the error message ‘wxTopLevelWindowGTK’ is not an accessible base of ‘MyFrame’ is a pretty good description of what has gone wrong.