Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Help compiling a simple beginners program
Biplab:
--- Quote from: mrpringle on January 06, 2007, 12:00:24 pm ---Here is Basic.h
#ifndef BASIC_H
#define BASIC_H
#include <wx/wx.h> // <-- Missing Header
class Basic: public wxApp
{
public:
virtual bool OnInit();
};
class BasicFrame: public wxFrame
{
public:
BasicFrame(const wxString & title, int xpos, int ypos, int width, int height);
~BasicFrame();
};
#endif
--- End quote ---
Add the missing header, highlighted in red colour, in the Basic.h file.
--- Quote from: mrpringle on January 06, 2007, 12:00:24 pm ---Another thing which I'm unsure about is the use of the _ symbol on this line:
BasicFrame *frame = new BasicFrame(_("Sample"), 50,50,450,300);
What does the _ in _("Sample") do?
--- End quote ---
That basically converts the char * to wxChar * which is used to construct wxString for title parameter used in frame class' constructor. But this is an advanced call. wxWidgets manual defines it in the following way.
--- Quote ---_
const wxChar * _(const char *s)
This macro expands into a call to wxGetTranslation function, so it marks the message for the extraction by xgettext just as wxTRANSLATE does, but also returns the translation of the string for the current locale during execution.
Don't confuse this macro with _T()!
--- End quote ---
Hope this helps. :)
P.S. - This is a Code::Blocks development related forum. So from next time please post such requests in other section.
mrpringle:
--- Quote from: Biplab on January 06, 2007, 05:34:51 pm ---
--- Quote from: mrpringle on January 06, 2007, 12:00:24 pm ---Here is Basic.h
#ifndef BASIC_H
#define BASIC_H
#include <wx/wx.h> // <-- Missing Header
class Basic: public wxApp
{
public:
virtual bool OnInit();
};
class BasicFrame: public wxFrame
{
public:
BasicFrame(const wxString & title, int xpos, int ypos, int width, int height);
~BasicFrame();
};
#endif
--- End quote ---
Add the missing header, highlighted in red colour, in the Basic.h file.
--- Quote from: mrpringle on January 06, 2007, 12:00:24 pm ---Another thing which I'm unsure about is the use of the _ symbol on this line:
BasicFrame *frame = new BasicFrame(_("Sample"), 50,50,450,300);
What does the _ in _("Sample") do?
--- End quote ---
That basically converts the char * to wxChar * which is used to construct wxString for title parameter used in frame class' constructor. But this is an advanced call. wxWidgets manual defines it in the following way.
--- Quote ---_
const wxChar * _(const char *s)
This macro expands into a call to wxGetTranslation function, so it marks the message for the extraction by xgettext just as wxTRANSLATE does, but also returns the translation of the string for the current locale during execution.
Don't confuse this macro with _T()!
--- End quote ---
Hope this helps. :)
P.S. - This is a Code::Blocks development related forum. So from next time please post such requests in other section.
--- End quote ---
Thanks.
Navigation
[0] Message Index
[*] Previous page
Go to full version