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
Topic archived. No new replies allowed.