0

我有 size_t sums[4] = {0, 0, 0, 0};

和一个文本框,我试图在其中显示我对其进行一些操作后得到的值。该值在 sums[i] 中,但是现在我想在文本框中显示该值,我正在这样做:

  *TextBox4 << "hello" << size_t sums;

frame->Connect(TEXT_BOX4, wxEVT_COMMAND_BUTTON_CLICKED | wxEVT_COMMAND_ENTER, (wxObjectEventFunction) & MyFrame::OnGenerateKey);

TextBox4 = new wxTextCtrl(this, TEXT_BOX4, wxT(""), wxPoint(200, 200), wxSize(200, 20), wxTE_PROCESS_ENTER | wxTE_READONLY | wxTE_LEFT, wxDefaultValidator, wxT("WxTextBox4"));

但是它会产生以下错误

 base.cpp:212:22: error: ambiguous overload for 'operator<<' in '*((MyFrame*)this)->MyFrame::TextBox4 << sum'
base.cpp:212:22: note: candidates are:
C:\wxWidgets-2.8.12\include/wx/textctrl.h:419:17: note: wxTextCtrl& wxTextCtrlBase::operator<<(const wxString&)
C:\wxWidgets-2.8.12\include/wx/textctrl.h:420:17: note: wxTextCtrl& wxTextCtrlBase::operator<<(int)
C:\wxWidgets-2.8.12\include/wx/textctrl.h:421:17: note: wxTextCtrl& wxTextCtrlBase::operator<<(long int)
C:\wxWidgets-2.8.12\include/wx/textctrl.h:422:17: note: wxTextCtrl& wxTextCtrlBase::operator<<(float)
C:\wxWidgets-2.8.12\include/wx/textctrl.h:423:17: note: wxTextCtrl& wxTextCtrlBase::operator<<(double)
C:\wxWidgets-2.8.12\include/wx/textctrl.h:424:17: note: wxTextCtrl& wxTextCtrlBase::operator<<(wxChar)

请帮我。

4

1 回答 1

1

首先,您不能打印这样的静态数组,您需要对其进行迭代。其次 - 你应该只打印没有类型的总和:

*TextBox4 << "你好" << sum;

但这可能还不足以帮助您 - 我需要更多背景信息。

于 2012-07-19T07:26:19.797 回答