This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ code not working under 2.96


I apologise for this posting being quite long, it is mostly header code i am 
having trouble using when i am compiling.

I am trying to compile C++ code with gcc 2.96 (it works fine in 2.95.3 and 
egcs). Im sure the problem is due to the increased standards 2.96 has over 
the previous versions....

I keep getting this error thrown back at me every time:
---
mpviewgui.h: In method `MpViewSetSelect<T>::MpViewSetSelect (MpWindow
&, T *, int, int, int, int)':
../../include/mpwindow.h:105: `class MpWindow' is inaccessible
mpviewgui.h:220: within this context

---

I have included the relevant areas of the headers which are giving the 
problem (mpwindow.h, mpviewgui.h) with the line numbers noted.

i am a c programmer so i have a lot of trouble trying to identify the 
problem here. I would really really appreciate it if somebody could offer me 
a solution....

cheers,
Sam, Ireland

(These sample headers are part of the matpack c++ library)

---
file mpviewgui.h:

template <class T>
class MpViewSetSelect: public MpSpinBox
{
  public:
    T *Instance;
    MpViewSetSelect (MpWindow &parent, T *Instance, int w, int h, int x, int 
y)
line 220->      : MpSpinBox(parent,1,w,h,x,y), Instance(Instance) { 
SetRange(1,999,1); }
    virtual void ValueChanged (int val) { Instance->Update();  }
};

---
file mpwindow.h:

class MpWindow : MpTimerInterface // inherit the interval timer interface
line 105-> {
  friend MpGlobal;
  friend MpFrame;

  private:
    MpWindow (const MpWindow&) { }              // no copying allowed
    MpWindow& operator = (const MpWindow&) { return *this; }  // no 
assignment allowed
    int width_, height_;	// width and height of this window

    const MpColor *background_color;

    Window xwin;		// identifier of the X window structure
    MpCursor cursor;            // cursor for this window
    bool hidden; 		// if true do not map the window
    long EventMask; 	        // mask for XSelectInput
    int border_width;		// border width of window

    virtual void TimerEvent (MpTimerInfo *info);  // timer is expired

  protected:
    MpWindow (void) { }  	// constructor for root window

    virtual string Tr(const char* text); // translator - NOT YET

    virtual void AddChild (MpWindow *) {}		 // fit the parent geometry

    virtual void EventDispatcher (XEvent &event);        // event dispatcher

    // define windows event filter: If filter returns true then the event is 
not
    // passed to he windows event dispatcher. Otherwise, if the filter 
returns false
    // the event is processed as usual.
    virtual bool EventFilter     (MpWindow* target, XEvent &event);

    // callback functions for events
    virtual void BPress_CB       (XButtonEvent) {}	 // any button press
    virtual void BPress_1_CB     (XButtonEvent) {}	 // button 1 press
    virtual void BPress_2_CB     (XButtonEvent) {}	 // button 2 press
    virtual void BPress_3_CB     (XButtonEvent) ;	 // button 3 press
    virtual void BRelease_CB     (XButtonEvent) {}	 // any button release
    virtual void BRelease_1_CB   (XButtonEvent) {}	 // button 1 release
    virtual void BRelease_2_CB   (XButtonEvent) {}	 // button 2 release
    virtual void BRelease_3_CB   (XButtonEvent) {}	 // button 3 release
    virtual void BDoubleClick_CB (XButtonEvent) {}       // double click
    virtual void MouseWheel_CB   (XButtonEvent,int) {}   // wheel rotation
    virtual void Enter_CB        (XCrossingEvent) {}	 // enter a window
    virtual void Leave_CB        (XCrossingEvent) {}	 // leave a window
    virtual void Motion_CB       (XMotionEvent) {} 	 // pointer movements
    virtual void Expose_CB       (XExposeEvent);	 // window expose
    virtual void KeyPress_CB     (XKeyEvent) {}		 // key press
    virtual void Configure_CB    (XConfigureEvent) {}	 // only MpFrames
    virtual void ClientMsg_CB    (XClientMessageEvent) {}// message from 
winmanager
    virtual void Selection_CB    (XSelectionEvent) {}	 // selection
    virtual void SelectionClear_CB   (XSelectionClearEvent) {}
    virtual void SelectionRequest_CB (XSelectionRequestEvent) {}
    virtual bool GUIColorChange_CB (void) { return false; } // GUI colors 
changed
    virtual void TimerExpired_CB (MpTimerInfo *info) {}

  public:

    Window Win (void) const { return xwin; }   // return identifier of X 
window structure

    GC DrawGC,			// current GC for drawing
       TextGC;			// current GC for text writing

    MpHelpPopupWindow* help;	// optional help popup
    MpWindow *parentw;		// pointer to the parent
    MpFrame* MainWindow; 	// main window of this window, direct child of 
root
    MpWindowList* children;     // list of children
    int type;			// to distinguish simple <-> pulldown window

    // constructor for general window
    MpWindow (MpWindow& parent,
	      int w = 0, int h = 0, int x = 0, int y = 0, int border_width = 0);
    virtual ~MpWindow (void);

    // return width and height of window in units of pixel
    int Width  (void) const { return width_; }
    int Height (void) const { return height_; }

    
//-------------------------------------------------------------------------//
    // Member functions:
    //   void AddEventMask (long event_mask)
    //   void RemoveEventMask (long event_mask)
    //   long GetEventMask (void) const
    //
    // Description:
    //   Add/remove mask for events the window will be able to receive.
    //   All X11 event masks can be used. The change is not immediately
    //   effective. You have to call either MpWindow::Realize() to activate
    //   the new event setting (the window is also mapped by this method)
    //   or to call XSelectInput(Mp.theDisplay, Win(), GetEventMask())
    //   to activate the events without mapping the window.
    //   But usually you will set the event mask in the constructor of your
    //   derived class before mapping. Hence, you don't have to activate
    //   the changed events explicitely, because Realize() is called
    //   automatically when your window is displayed the first time.
    
//-------------------------------------------------------------------------//
    void AddEventMask    (long event_mask) { EventMask |=  event_mask; }
    void RemoveEventMask (long event_mask) { EventMask &= ~event_mask; }

    // returns current event mask setting
    long GetEventMask (void) const { return EventMask; }

    // for internal use only : set width and height. Sets variables only, 
but doesn't
    // realy resize window. Use Configure() and Resize() methods instead.
    int SetWidth  (int w) { width_  = w; return w; }
    int SetHeight (int h) { height_ = h; return h; }
    void SetSize (int w, int h) { width_ = w; height_ = h; }

    // virtual functions that can be overloaded
    virtual void DrawWhenMapped (void) { }     		  // called by Map()
    virtual void Clear (void);				  // clear window
    virtual int  EffectiveWidth (void) { return Width(); }// width without 
pictures
    virtual void DrawLine (int x0, int y0, int x1, int y1, GC gc);// draw 
line
    virtual void DrawPoint (int x, int y);		  // draw point
    virtual void Move (int, int);			  // move this
    virtual void Configure (int w, int h);		  // resize this
    virtual void Configure (int w, int h, int x, int y);  // resize and move 
this
    virtual void Redraw (void) { }			  // redraw the window
    virtual void ResizeChildren (int,int);
    virtual void Resize (int, int);			  // resize this+all children
    virtual void SetLanguage (const char **) { }	  // language change

    // action for windows, that are managed from MpRadioButton callbacks
    virtual void Action (const char*, const char*, void* = 0) { }

    // non-virtual functions
    void SetBackingStore (bool);// set backing store to "WhenMapped"
    bool GetBackingStore (void) const;

    void SetSaveUnder (bool);	// save covered region when mapped
    bool GetSaveUnder (void) const;

    void SetDecoration (bool);  // window manager decoration
    bool GetDecoration (void) const;

    void SetMinMaxWindowSize (int wmin, int hmin, int wmax, int hmax);

    void Realize (void);	// realize window
    void RealizeAll (void);	// realize window and child tree

    void Map (void);		// map the window, also called by Realize()
    void Unmap (void);      	// unmap the window

    void Hide (void) { hidden = true; } // don't appear if mapped, first 
unmap!
    void Unhide (void) { hidden = false; } // unlock the hiding
    bool IsHidden (void) { return hidden; }
    bool IsVisible (void);	// return true if visible

    void AddHelp (const char *win_name, const char *text[]);
				// add help window to Button 3

    // set/get windows cursor
    void SetCursor (const MpCursor &cursor);
    MpCursor GetCursor (void) const;

    // draw string
    void PlaceText (const char* string, const MpRectangle<short>& rect,
		    const XFontStruct* fn = 0, int mode = 0); // centered!
    void PlaceText (const char *string, int x = 0, int y = 0,
		    const XFontStruct* fn = 0, int mode = 0); // centered!

    // set color of window background (or refresh if = 0)
    void SetBackground (const MpColor *color = 0);
};

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]