【发布时间】:2012-01-19 16:16:29
【问题描述】:
我正在尝试使此代码正常工作,但我做不到。我希望它可以运行,以便我可以在我的其他项目中使用它。我刚在网上看到这个。这是关于 wxOGL 的。
#include <wx/wx.h>
#include <wx/ogl/ogl.h>
#include <wx/cursor.h>
class MyApp: public wxApp
{
virtual bool OnInit();
};
class MyFrame: public wxFrame
{
wxDiagram * diagram;
wxShape * shape;
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
~MyFrame();
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame(_("wxWidgets - Object Graphics Library"),
wxPoint(50, 50), wxSize(450, 340) );
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxShapeCanvas *canvas = new wxShapeCanvas(this, wxID_ANY, pos, size, 0, _T("a"));
canvas->SetBackgroundColour(*wxWHITE);
canvas->SetCursor(wxCursor(wxCURSOR_CROSS));
diagram = new wxDiagram();
canvas->SetDiagram(diagram);
shape = new wxCircleShape(20.0);
shape->SetX(25.0);
shape->SetY(25.0);
canvas->AddShape(shape);
diagram->ShowAll(1);
}
MyFrame::~MyFrame()
{
delete shape;
delete diagram;
}
我不知道它是做什么的,我只是想看看它。当我在 Code::Blocks 中编译它时,它不断返回错误说“wx/wx.h:没有这样的文件目录”和其他错误。有谁可以解决这个问题?
【问题讨论】:
标签: c++ wxwidgets codeblocks