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://www.pickinpatchfarm.com/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
Registered users can post here. Sign in or register to post.
  • 452471514 2018-02-18
  • 5299351513 2018-02-18
  • 3036511512 2018-02-18
  • 4224301511 2018-02-18
  • 6975481510 2018-02-18
  • 8259761509 2018-02-18
  • 7007851508 2018-02-18
  • 7796301507 2018-02-18
  • 567811506 2018-02-18
  • 2107511505 2018-02-18
  • 8923811504 2018-02-17
  • 6039601503 2018-02-17
  • 8788931502 2018-02-17
  • 4539021501 2018-02-17
  • 661851500 2018-02-17
  • 9152461499 2018-02-17
  • 4757661498 2018-02-17
  • 981131497 2018-02-17
  • 4385321496 2018-02-17
  • 5046771495 2018-02-17