【发布时间】:2014-01-17 10:01:20
【问题描述】:
我正在尝试使用 XCode 4.6 在 OS X 10.8 中构建第一个基本的 wxWidgets 应用程序。我在窗口 SetName() 中收到 EXC_BAD_ACCESS 错误。
这是我使用的代码:
#include "main.h"
#include <wx/wx.h>
class MyApp : public wxApp
{
virtual bool OnInit();
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
wxFrame *frame = new wxFrame(NULL, -1, wxT("Hello World"), wxPoint(50, 50),
wxSize(450, 350));
frame->Show(true);
return true;
}
评论后编辑: 对不起
这里是错误链:
1) Create(parent, id, title, pos, size, style, name);
2) if (!wxTopLevelWindow::Create(parent, id, title, pos, size, style, name);
3) if (!wxNonOwnedWindow::Create(parent, id, title, pos, size, style, name))
4) setName(name);
5) m_impl = stringSrc.m_impl;
之后是机器码
杰夫
EDIT2 : 刚刚用 wxWidgets 3.0 试过,结果是一样的。
【问题讨论】:
-
"我在窗口 SetName() 中收到 EXC_BAD_ACCESS 错误" -- 我在您的代码中看不到
SetName。 -
我对wxWidgets一无所知,但是官方网站上给出的“Hello World”示例说你必须从
wxFrame派生一个自定义框架并使用它。你试过这样做吗? wxwidgets.org/docs/tutorials/hello.htm -
我尝试通过您的链接访问 helloWorld,但出现了同样的错误,但在不同的位置:static unsigned long DoStringHash(T *k)
-
当它崩溃时你能发布一个正确的(和完整的)堆栈跟踪吗?
标签: c++ macos osx-mountain-lion wxwidgets exc-bad-access