gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 00:40:19 25 4
gpt4 key购买 nike

我正在尝试编译 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com