wxwidgets no main function

so after a full 12 hours trying to get Wxwidgets set up finally it seems to work,I reinstalled everything and cleaned up codeblocks directory etc,

anyway what I noticed is wxwidgets doesn't have a main function,how is this possible I thought every program needs a main function,as it's the starting point yet instead it seems to start from a onInit function which returns a bool

how does this work without a main function?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  #ifdef WX_PRECOMP
#include "wx_pch.h"
#endif

#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__

#include "yguyguyApp.h"
#include "yguyguyMain.h"
#include "wx/wx.h"

IMPLEMENT_APP(yguyguyApp);

bool yguyguyApp::OnInit()
{
    wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, _T("Hello wxWidgets World"));
	frame->CreateStatusBar();
	frame->SetStatusText(_T("Hello World"));
	frame->Show(true);
	SetTopWindow(frame);
	return true;
}
The main function is implemented internally by wxWidgets, when you call wxIMPLEMENT_APP.
thanks Yanson
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