无构造函数可以接受源类型,或构造函数重载决策不明确,新手上路,请大家帮忙改改错
//stdafx.h
#ifndef WX_PCH_H_INCLUDED
#define WX_PCH_H_INCLUDED
// basic wxWidgets headers
#include <wx/wxprec.h>
#ifdef WX_PRECOMP
// put here all your rarely-changing header files
#include <wx/wx.h>
#endif // WX_PRECOMP
#endif // WX_PCH_H_INCLUDED
//identifies.h
#ifndef IDENTIFIERS_H
#define IDENTIFIERS_H
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
class Ident : public wxFrame
{
public:
Ident(const wxString& title);
};
#endif
//identifies.cpp
#include <stdafx.h>
#include "identifiers.h"
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
Ident *ident = new Ident("Identifiers");
ident->Show(true);
return true;
}
Ident::Ident(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(200,150))
{
wxPanel *panel = new wxPanel(this, -1);
wxGridSizer *grid = new wxGridSizer(2, 3);//该行报错
grid->Add(new wxButton(panel, wxID_CANCEL), 0, wxTOP | wxLEFT, 9);
grid->Add(new wxButton(panel, wxID_DELETE), 0, wxTOP, 9);
grid->Add(new wxButton(panel, wxID_SAVE), 0, wxLEFT, 9);
grid->Add(new wxButton(panel, wxID_EXIT));
grid->Add(new wxButton(panel, wxID_STOP), 0, wxLEFT, 9);
grid->Add(new wxButton(panel, wxID_NEW));
panel->SetSizer(grid);
Centre();
}
使用的是VS2010和 wxWidgets
编译错误如下:
1>identifiers.cpp(18): error C2664: “wxGridSizer::wxGridSizer(int,const wxSize &)”: 不能将参数 2 从“int”转换为“const wxSize &”
1> 原因如下: 无法从“int”转换为“const wxSize”
1> 无构造函数可以接受源类型,或构造函数重载决策不明确