After pondering and wondering, I have decided to go for wxWidgets. Here is my first trial application. After running a test app from zetcode.com in my Code::Blocks & wxWidgets and I confirmed that it is fine! Then I tried to write my own app as shown below but I ran errors. Please correct me wher I have gone wrong, and any suggestion in the code. I'm just starting with wxWidgets
Cheers :)
#include <wx/wx.h>
class MyApp : public wxApp
{
virtual bool OnInit();
};
class MyFrame : public wxFrame
{
public:
MyFrame(const wxString& title);
};
IMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
wxFrame *newFrame = new wxFrame(wxT("Hello Mary!"));
newFrame->Show();
return true;
}
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
Centre();
}
Errors:
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|1|wx/wx.h: No such file or directory|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|3|error: expected class-name before '{' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|8|error: expected class-name before '{' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|10|error: expected `,' or `...' before '&' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|10|error: ISO C++ forbids declaration of `wxString' with no type|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|13|error: expected constructor, destructor, or type conversion before ';' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp||In member function `virtual bool MyApp::OnInit()':|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|error: `wxFrame' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|error: `newFrame' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|error: `wxFrame' is not a type|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|error: `wxT' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|warning: unused variable 'wxFrame'|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|17|warning: unused variable 'wxT'|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|22|error: expected `,' or `...' before '&' token|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|error: ISO C++ forbids declaration of `wxString' with no type|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp||In constructor `MyFrame::MyFrame(int)':|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|error: class `MyFrame' does not have any field named `wxFrame'|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|error: `NULL' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|error: `wxID_ANY' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|error: `title' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|error: `wxDefaultPosition' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|error: `wxSize' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|25|error: `Centre' was not declared in this scope|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|25|warning: unused variable 'Centre'|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|warning: unused variable 'NULL'|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|warning: unused variable 'wxID_ANY'|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|warning: unused variable 'title'|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|warning: unused variable 'wxDefaultPosition'|
C:\Documents and Settings\smtangoo\My Documents\C++ projects\myfirst\main.cpp|23|warning: unused variable 'wxSize'|
||=== Build finished: 19 errors, 8 warnings ===|