Menu

#179 Undefined symbols when using PersistException class

Anything_Else
open
nobody
5
2012-11-20
2004-03-23
No

When building a program that uses the persistence
library (commoncpp2-1.1.1) and exceptions for the
persistence library, the following link time errors will
result:

undefined reference to `ost::PersistException::getString
() const'
undefined reference to
`ost::PersistException::~PersistException [not-in-
charge]()'

Two files need to be patched: persist.h and persist.cpp
to provide these two methods. Patch file fragments
provided below:

*** persist.cpp.orig Thu Jan 29 20:08:15 2004
--- persist.cpp Tue Mar 23 11:33:31 2004
***************
*** 53,59 ****
#endif

#ifdef CCXX_EXCEPTIONS
! #ifndef COMMON_STD_EXCEPTION

PersistException::PersistException(String const&
reason)
: _what(reason)
--- 53,59 ----
#endif

#ifdef CCXX_EXCEPTIONS
! # ifndef COMMON_STD_EXCEPTION

PersistException::PersistException(String const&
reason)
: _what(reason)
***************
*** 65,72 ****
{
return _what;
}

! #endif
#endif

const char* BaseObject::getPersistenceID() const
--- 65,80 ----
{
return _what;
}
+ # else
+ PersistException::~PersistException() throw()
+ {
+ }
+ const char* PersistException::getString() const
+ {
+ return Exception::getString();
+ }

! # endif
#endif

const char* BaseObject::getPersistenceID() const

*** persist.cpp.orig Thu Jan 29 20:08:15 2004
--- persist.cpp Tue Mar 23 11:33:31 2004
***************
*** 53,59 ****
#endif

#ifdef CCXX_EXCEPTIONS
! #ifndef COMMON_STD_EXCEPTION

PersistException::PersistException(String const&
reason)
: _what(reason)
--- 53,59 ----
#endif

#ifdef CCXX_EXCEPTIONS
! # ifndef COMMON_STD_EXCEPTION

PersistException::PersistException(String const&
reason)
: _what(reason)
***************
*** 65,72 ****
{
return _what;
}

! #endif
#endif

const char* BaseObject::getPersistenceID() const
--- 65,80 ----
{
return _what;
}
+ # else
+ PersistException::~PersistException() throw()
+ {
+ }
+ const char* PersistException::getString() const
+ {
+ return Exception::getString();
+ }

! # endif
#endif

const char* BaseObject::getPersistenceID() const

Discussion


Log in to post a comment.