public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem using a custom exception class
@ 2004-08-14  7:37 Jeffrey Holle
  2004-08-14 18:01 ` Jeffrey Holle
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Holle @ 2004-08-14  7:37 UTC (permalink / raw)
  To: gcc-help

I'm using gcc v3.4.1.

I've a custom exception class which I'm using in a library that compiles 
   without any compiler errors/warnings.

When I attempt to use this library, I get:
   : undefined reference to `typeinfo for attribute_error'


My custom exception class, modeled using info from stdexcept, is:

class attribute_error : public std::exception
{
public:
   explicit attribute_error(const std::string& attributeName) throw(); 
// used for missing attribute
   explicit attribute_error(const std::string& attributeName, const 
std::string& msg) throw();
   virtual ~attribute_error() throw() {}
   virtual const char* what() const throw();
private:
   std::string msg_;
};


Can someone point me to how to fix this?

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

* Re: problem using a custom exception class
  2004-08-14  7:37 problem using a custom exception class Jeffrey Holle
@ 2004-08-14 18:01 ` Jeffrey Holle
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey Holle @ 2004-08-14 18:01 UTC (permalink / raw)
  To: gcc-help

An update.
I was able to avoid this problem by replacing attribute_error with 
runtime_error.  I don't want to keep my code this way, attribute_error 
hides use of ostringstring to format a meanful error...
So I still would like to know what is wrong with my attribute_error class.

Before somebody asks:
   1.  I did include the implementation of attribute_error in the library.
   2.  I tried to link all the files of my library instead of using a 
library.  I got the very same results...

Jeffrey Holle wrote:
> I'm using gcc v3.4.1.
> 
> I've a custom exception class which I'm using in a library that compiles 
>   without any compiler errors/warnings.
> 
> When I attempt to use this library, I get:
>   : undefined reference to `typeinfo for attribute_error'
> 
> 
> My custom exception class, modeled using info from stdexcept, is:
> 
> class attribute_error : public std::exception
> {
> public:
>   explicit attribute_error(const std::string& attributeName) throw(); // 
> used for missing attribute
>   explicit attribute_error(const std::string& attributeName, const 
> std::string& msg) throw();
>   virtual ~attribute_error() throw() {}
>   virtual const char* what() const throw();
> private:
>   std::string msg_;
> };
> 
> 
> Can someone point me to how to fix this?
> 
> 

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

end of thread, other threads:[~2004-08-14 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-14  7:37 problem using a custom exception class Jeffrey Holle
2004-08-14 18:01 ` Jeffrey Holle

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).