gpt4 book ai didi

c++ - EXC_BAD_ACCESS 与 OSX 中的 wxWidgets

转载 作者:行者123 更新时间:2023-11-28 07:09:53 25 4
gpt4 key购买 nike

我正在尝试使用 XCode 4.6 在 OS X 10.8 中构建第一个基本的 wxWidget 应用程序。我在窗口 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,它是一样的。

最佳答案

您的 wxWidgets 构建似乎很糟糕,或者至少与您的程序不兼容,因为您绝对不应该像您看起来那样在 wxString 分配中崩溃。请使用完全相同的编译器和编译选项重新构建 wxWidgets 和您自己的应用程序,问题应该会神奇地消失。

关于c++ - EXC_BAD_ACCESS 与 OSX 中的 wxWidgets,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21182957/

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