public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Problems with compiling classes on gcc 3.2.20020903
       [not found] <616BE6A276E3714788D2AC35C40CD18DA270F8@whale.softwire.co.uk>
@ 2003-02-05 13:40 ` Rupert Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Rupert Wood @ 2003-02-05 13:40 UTC (permalink / raw)
  To: 'Eilmsteiner Reinhard'; +Cc: gcc-help

Eilmsteiner Reinhard wrote:

> I'm currently trying to compile a program that worked fine when I
> compiled it on a g++ on SuSE 7.3. Then I switched to  g++ (GCC) 3.2
> 20020903 on RedHat 8.0. 

Not sure why the switch would have done this, but:

> #include <exception> 
:
> class CException: public exception 

exception doesn't exist in the top-level namespace. std::exception
should work.

I think some implementations of the STL (e.g. the Dinkumware STL that
came with MSVC++6; don't know if Dinkum-for-Linux does) define exception
in the top level namespace and then imports it into std with using
::exception. In other words, you can get away with either exception or
std::exception. Skimming the C++ standard quickly, you should probably
only rely on std::exception.

In general, 'Parse Error' really means 'undefined type'.

Hope that helps,
Rup.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Problems with compiling classes on gcc 3.2.20020903
@ 2003-02-05 12:17 Eilmsteiner Reinhard
  0 siblings, 0 replies; 2+ messages in thread
From: Eilmsteiner Reinhard @ 2003-02-05 12:17 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi! 

I'm currently trying to compile a program that worked fine when I compiled
it on a g++ on SuSE 7.3. Then I switched to  g++ (GCC) 3.2 20020903 on
RedHat 8.0. 

This is what i get now: 
make -k 
g++ -ggdb -I../../include -c cexception.cc 
In file included from cexception.cc:17: 
cexception.h:31: parse error before `{' token 
cexception.h:36: destructors must be member functions 
cexception.h:36: virtual outside class declaration 
cexception.h:37: virtual outside class declaration 
cexception.h:38: virtual outside class declaration 
cexception.h:38: non-member function `int GetErrorMessageBufferSize()'
cannot 
   have `const' method qualifier 
.... 

from the headerfile cexception.h: 
//File: cexception.h 

////////////////////////////////////////////////////////////////////////////
//// 
// 
// Generic exception class 
// 
// $Id$ 
// 
////////////////////////////////////////////////////////////////////////////
//// 

#ifndef _CEXCEPTION_H_ 
#define _CEXCEPTION_H_ 

////////////////////////////////////////////////////////////////////////////
//// 

//Global inclusions 
#include <exception> 
#include <stdarg.h> 

//Local inclusions 
#include "cstring.h" 

////////////////////////////////////////////////////////////////////////////
//// 

typedef const char *TErrMsgList []; 
typedef const char **PErrMsgList; 

////////////////////////////////////////////////////////////////////////////
//// 

class CException: public exception 
{ // !! *** Line 31 *** !! 
public: 
  virtual const char *what () const; 
protected: 
  CException (int iErr, PErrMsgList pErrMsgList); 
  virtual ~CException (); 
  virtual void SetErrorMessage (va_list args); 
  virtual int GetErrorMessageBufferSize () const; 
  CString m_sErrMsg; 
  int m_iErrNr; 
  PErrMsgList m_pErrMsg; 
}; 

////////////////////////////////////////////////////////////////////////////
//// 

#endif 

What is going wrong??? 

Please advise, 
Reinhard. 

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPkEAx1aO5+5ahqodEQK2mACg9fafTs7dJmFzIv4jmNgeFOOiP1kAn3lF
k8+Ze7I3qHeRvGofxNvwQ2CW
=LdZK
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-02-05 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616BE6A276E3714788D2AC35C40CD18DA270F8@whale.softwire.co.uk>
2003-02-05 13:40 ` Problems with compiling classes on gcc 3.2.20020903 Rupert Wood
2003-02-05 12:17 Eilmsteiner Reinhard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).