Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Compiling issue under Red Hat 6.2

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

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Compiling issue under Red Hat 6.2
#4863
Posted by: grantb 2004-07-20 23:48:05
I have a wxWidgets based application that was build initially under Windows and then rigorously tested under Fedora Core 2 to help ensure its platform independence.

It became necessary to test the same app and code on other versions of linux, under Red Hat 8 it was successful, and currently I am trying to get it to work under Red Hat 6.2 (I know it’s old, but making it work under RH6.2 is required).

Note: when building from source under RH8 and FC2, the existing source and configure file work flawlessly, only under RH6.2 have these problems come up. Also, wxWidgets 2.4.2 is installed and can be used to build and run the samples without a problem.

When I attempt to build under Red Hat 6.2 with gcc version egcs-2.91.66 (version installed by default) the following are the first errors to occure:


UpdateEvent.h:25: waning: ANSI C++ forbids declaration ‘evt_UPDATEEVENT’ with no type
UpdateEvent.h:25: waning: ANSI C++ forbids declaration ‘wxID_ANY’ with no type
UpdateEvent.h:25: ‘int wx_ID_ANY’ redeclared as different kind of symbol
/usr/local/include/wx/defs.h:1285:previous declaration of ‘enum {anonymous} const wxID_ANY’
UpdateEvent.h:28: waning: return-type of ‘wxObjectEventFunction’ defaults to ‘int’
UpdateEvent.h:28: waning: ‘wxObjectEventFunction’ declared as function returning a function
/usr/local/include/wx/event.h:1891: previous non-function declared ‘typdef void (wxObject::* wxObjectEventFunction)(class wxEvent &)’
UpdateEvent.h:28: parse error before ‘&’

Thinking this might be a compiler issue, I upgraded gcc to 3.4.1 and the above errors were replaced with:

UpdateEvent.h:25 error: expected constructor, destructor, or type conversion before ',' token
UpdateEvent.h:25 error: expected constructor, destructor, or type conversion before ',' token
UpdateEvent.h:25 error: expected constructor, destructor, or type conversion before ',' token
UpdateEvent.h:25 error: expected unqualified-id before ‘/’ token
UpdateEvent.h:25 error: expected ‘,’ or ‘;’ before ‘/’ token


And now... for a bit of source code:

UpdateEvent.h:



#ifndef _UPDATEEVENT_H_
#define _UPDATEEVENT_H_

#include <wx/wx.h>

extern const wxEventType evt_UPDATEEVENT;

class CUpdateEvent : public wxEvent
{
public:
   CUpdateEvent( int id = -1 );
   wxEvent* Clone( void ) const { return new CUpdateEvent( *this ); }

private:
   DECLARE_DYNAMIC_CLASS( CUpdateEvent )
};

typedef void (wxEvtHandler::*UpdateEventFunction)(CUpdateEvent&);



#define EVT_UPDATEEVENT(id, fn) DECLARE_EVENT_TABLE_ENTRY(   \
                              evt_UPDATEEVENT, id, wxID_ANY, \
                              (wxObjectEventFunction)    \
                               (wxEventFunction)         \
                               (UpdateEventFunction)&fn,  \
                              (wxObject *) NULL \
                              ),



#endif //_UPDATEEVENT_H_


UpdateEvent.cpp:


#include "UpdateEvent.h"

IMPLEMENT_DYNAMIC_CLASS( CUpdateEvent, wxEvent )

const wxEventType evt_UPDATEEVENT = wxNewEventType();

CUpdateEvent::CUpdateEvent( int id )
:wxEvent( id, evt_UPDATEEVENT )
{
}


Any thoughts?
Message2. Re: Compiling issue under Red Hat 6.2
#4865
Posted by: upCASE 2004-07-21 01:06:30
Hi!
"#define EVT_UPDATEEVENT(id, fn) DECLARE_EVENT_TABLE_ENTRY(   \
                              evt_UPDATEEVENT, id, wxID_ANY, \
                              (wxObjectEventFunction)    \
                               (wxEventFunction)         \
                               (UpdateEventFunction)&fn,  \
                              (wxObject *) NULL \
                              ),"
Notice the "," behind the macro. Delete it.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: Compiling issue under Red Hat 6.2
#4866
Posted by: grantb 2004-07-21 02:47:21
Thanks for the reply upCASE, unfortunately deleting the comma has no effect.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-11-28  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0