I have just started to learn wxWidgets and have zero experience. I was recommended to check this tutorial.
So I created a 'console application' in Code Blocks 13.12 ( Win 7 ) , selected wxWidgets 3.0 , and tried to insert the code from tutorial into my code. The basic code that Code Blocks provided me upon project creation was :
#include <iostream>
using namespace std;
int main()
{
// "hello world" with cout
return 0;
}
Despite trying to insert the tutorial code in various ways, the program never compiled, I always got many errors. Apart from my lack of skills using wxWidgets, I suspect one of the reasons may be that I have installed wxWidgets 3.0, and tutorial may be using an older version. Can someone please show me how to write this code in a CodeBlocks project to make it build and run successfully ? Thank you.
EDIT :
The code I tried to compile was :
#include <iostream>
using namespace std;
#include <wx/wx.h>
int main()
{
class OurApp : public wxApp
{
bool OnInit()
{
wxFrame* frame = new wxFrame(NULL, wxID_ANY, "Our First App");
frame->Show();
return true;
}
};
IMPLEMENT_APP(OurApp)
return 0;
}
This particular version returned errors :
N:\projekticpp\wxTestTutorial2\main.cpp|28|error: expected unqualified-id before string constant| N:\projekticpp\wxTestTutorial2\main.cpp|28|error: a function-definition is not allowed here before '{' token| N:\projekticpp\wxTestTutorial2\main.cpp|28|error: a function-definition is not allowed here before '{' token|
But trying other different ways of putting the code together, I got all sorts of different ones.