Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Compiler error for constructor of my implementation of wxFrame class

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Compiler error for constructor of my implementation of wxFrame class
#2433
Posted by: 2003-08-05 11:46:14
Can someone help me?
I am getting the following errors while compiling.

12 D:devcpp_projwx_hello_worldtextframe.cpp ISO C++ forbids defining types within return type
12 D:devcpp_projwx_hello_worldtextframe.cpp return type specification for constructor invalid
12 D:devcpp_projwx_hello_worldMakefile.win [Build Error]  [textframe.o] Error 1

My code is attached below. The offending line of code seems to be:

textframe::textframe(const wxChar* title, int xpos, int ypos, int width, int height)         
:wxFrame((wxFrame*) NULL, -1, title, wxPoint(xpos,ypos), wxSize(width, height))

I have no idea what is wrong. Can someone please explain?

//textframe.h
//--------------
#ifndef TEXTFRAME_H
#define TEXTFRAME_H

class textframe : public wxFrame
{
   public:
   //constructor
   textframe(const wxChar* title, int xpos, int ypos, int width, int height);
   //destructor
   ~textframe();
  
}

#endif //TEXTFRAME_H

//textframe.cpp
//----------------
#include "wx/wxprec.h"

#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

//headers
#include "textframe.h"

textframe::textframe(const wxChar* title, int xpos, int ypos, int width, int height)         
:wxFrame((wxFrame*) NULL, -1, title, wxPoint(xpos,ypos), wxSize(width, height))
{
}

textframe::~textframe()
{
}
Message2. Re: Compiler error for constructor of my implementation of wxFrame class
#2434
Posted by: guidance 2003-08-05 11:56:44
Why not the title is wxString according to wxmsw241 doc?

wxFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame")
Message3. Re: Compiler error for constructor of my implementation of wxFrame class
#2437
Posted by: 2003-08-05 12:10:12
I don't really know about the wxString. I am just following the wxTutorial pdf. i'll have to go take a look at the document file.

Holy Jeebuz! i found out my mistake. I forgot the semicolon after my class declaration.

class textframe:: public wxFrame
{
........
};

jeebuz what a wild goose chase.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2023-1-27  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0