was not declared in this scope

Hi guys I am trying to get a console window to appear and display a cout stream with my wxwidget app anyway I heard you can do this with two lines of code but it doesn't seem to be working instead it says was not declared in this scope

any idea how I can solve this?


thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47


#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif

#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__

#ifdef _DEBUG
wxIMPLEMENT_APP_CONSOLE(MyApp);
#else

#endif


#include "yguyguyApp.h"
#include "yguyguyMain.h"
#include "wx/wx.h"
#include <wx/textctrl.h>
#include <iostream>

IMPLEMENT_APP(yguyguyApp);

enum typel{


ID_TEXTCTRL = 1

};



bool yguyguyApp::OnInit()
{
    wxTextCtrl *TextCtrl = new wxTextCtrl(NULL, ID_TEXTCTRL, wxT(""), wxPoint(17, 5), wxSize(386, 242), 0);
    wxStreamToTextRedirector redirect(TextCtrl);
    wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, _T("Hello wxWidgets World"));
	frame->CreateStatusBar();
	frame->SetStatusText(_T("Hello World"));
	frame->Show(true);
	SetTopWindow(frame);
	std::cout << "hello wibuhdu" << std::endl;
	return true;
}



C:\Users\User\yguyguy\yguyguyApp.cpp|45|error: 'wxStreamToTextRedirector' was not declared in this scope|

Last edited on
it is not seeing the header that contains that type?
you could try adding a :: to the front of it, or seeing if you missed a #include.
http://docs.wxwidgets.org/3.0/classwx_stream_to_text_redirector.html
> You also must have wxUSE_STD_IOSTREAM option on (i.e. set to 1) in your setup.h to be able to use it.
Does that help? I have barely used wxwidgets so I just googled it.
thanks guys

yeah that's the problem I think I checked the setup.h header and can't seem to find it anywhere but will update it when I find it
Topic archived. No new replies allowed.