I've been trying to learn GUI programming in C++ following a tutorial about wxWidgets ( I installed the wxWidgets library, which installed itself to my C:\wxWindows-2.4.2\ folder.
I'm using Dev-C++ and here's the code I was trying:
I configured Dev-C++ to use "C:\wxWindows-2.4.2\include" as one of the include paths, so that "wx/wx.h" could be used when I compiled my code.
It gave 155 compile errors. The first set of lines from the error log mention that wx/setup.h is missing:
I've looked into it, and there is no setup.h file anywhere in the wx includes. There is one setup.h.in in the root directory (include/../) but any attempt to copy this file in there and rename it to setup.h just caused more errors.
I've tried two different versions of wxWidgets so far, and neither of them work; they both give this same error.
I just started learning C++ a few days ago and went through a tutorial provided at but I want to go on ot more advanced stuff (I'm an experienced Perl programmer so I picked up on C++ rather quickly). Any non-standard libraries seem to hate me for some reason. ;-)
So any help would be much appreciated.
I'm using Dev-C++ and here's the code I was trying:
Code:
/*
* hworld.cpp
* Hello world sample by Robert Roebling
*/
#include "wx/wx.h"
class MyApp: public wxApp
{
virtual bool OnInit();
};
class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
enum
{
ID_Quit = 1,
ID_About,
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( "Hello World", wxPoint(50,50), wxSize(450,340) );
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append( ID_About, "&About..." );
menuFile->AppendSeparator();
menuFile->Append( ID_Quit, "E&xit" );
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, "&File" );
SetMenuBar( menuBar );
CreateStatusBar();
SetStatusText( "Welcome to wxWindows!" );
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox("This is a wxWindows Hello world sample",
"About Hello World", wxOK | wxICON_INFORMATION, this);
}
I configured Dev-C++ to use "C:\wxWindows-2.4.2\include" as one of the include paths, so that "wx/wx.h" could be used when I compiled my code.
It gave 155 compile errors. The first set of lines from the error log mention that wx/setup.h is missing:
Code:
Compiler: Default compiler
Executing g++.exe...
g++.exe "D:\CPP\Tutorial\GUI.cpp" -o "D:\CPP\Tutorial\GUI.exe" -I"lib\gcc\mingw32\3.4.2\include" -I"include\c++\3.4.2\backward" -I"include\c++\3.4.2\mingw32" -I"include\c++\3.4.2" -I"include" -I"D:\CPP\RebeccaAIML-981\include" -I"C:\wxWindows-2.4.2\include" -L"lib" -L"D:\CPP\RebeccaAIML-981\include" -L"C:\wxWindows-2.4.2\include"
In file included from C:/wxWindows-2.4.2/include/wx/defs.h:23,
from C:/wxWindows-2.4.2/include/wx/wx.h:15,
from D:\CPP\Tutorial\GUI.cpp:6:
C:/wxWindows-2.4.2/include/wx/platform.h:85:22: wx/setup.h: No such file or directory
I've looked into it, and there is no setup.h file anywhere in the wx includes. There is one setup.h.in in the root directory (include/../) but any attempt to copy this file in there and rename it to setup.h just caused more errors.
I've tried two different versions of wxWidgets so far, and neither of them work; they both give this same error.
I just started learning C++ a few days ago and went through a tutorial provided at but I want to go on ot more advanced stuff (I'm an experienced Perl programmer so I picked up on C++ rather quickly). Any non-standard libraries seem to hate me for some reason. ;-)
So any help would be much appreciated.