c++ - 错误 : ‘virtual bool wxTopLevelWindowGTK::Show(bool)’ is inaccessible

标签 c++ wxwidgets

我正在尝试编译 wxWidgets 第一个示例命令行,并出现以下错误

/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’

我正在使用命令行编译程序

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

并获取以下错误日志:Error Log

完整代码:Source Code

最佳答案

class MyFrame : wxFrame

应该是

class MyFrame : public wxFrame

默认类继承是私有(private)的。在错误消息中,‘wxTopLevelWindowGTK’ is not an accessible base of ‘MyFrame’ 很好地描述了出现的问题。

关于c++ - 错误 : ‘virtual bool wxTopLevelWindowGTK::Show(bool)’ is inaccessible,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19218363/

相关文章:

c++ - 调试宏与调试变量

c++ - 如何使用指针获取字符串特定索引处的字符?

c++ - C++中按值传递和按引用传递的区别

c++ - wxHTTP::getinputstream() 是线程安全的吗?

c++ - 将 wxString 转换为 time_t

c++ - wxWidgets + Windows 上的 Cygwin

python - wx中如何同步两个网格的滚动条

c++ - OpenGL纹理用法

c++ - 为什么有人会使用 C 而不是 C++?

c++ - 如何以编程方式设置 wx Panel 派生类的维度?