Boost logo

Boost :

From: Brian Oberholtzer (brian.oberholtzer_at_[hidden])
Date: 2003-07-23 17:55:59


Ok, i was able to get things to work by adding the conditional compilation
code to my class (most deatils not included. You can see where I've been
declaring the shared_ptr. I don't reference the x variable at all in my
code but the linker is satisfied.

template <class T>
class MyClass
{
# if __SUNPRO_CC && __SUNPRO_CC <= 0x540
 boost::checked_deleter<T*> x;
#endif

 boost::shared_ptr<T*> _sptrItem;

}

"Christopher Currie" <christopher_at_[hidden]> wrote in message
news:3F1EF869.8000409_at_currie.com...
> Brian Oberholtzer wrote:
> > I'm trying to use shared_ptr in Forte 5.4 and am getting a link-time
error
> > like the following indicating an undefined reference...
> >
> > The error includes the following hint:
> > Hint: static member
> > boost::__RTTI__1nFboostPchecked_delete4CpnDstMbasic_string... must be
> > defined in the program. To me it appears that the compiler is expecting
a
> > parameterized checked_delete to be defined.
>
> You're close; it's actually trying to find the run-type typeinfo for an
> instantiation of boost::checked_deleter, which due to a bug in the Sun
> CC 5.4 compiler doesn't get linked in properly.
>
> Sun is aware of this bug; they have it listed as as bug number 4878628.
> Their bug report provides three workarounds. One is to explictly
> instantiate an instance of boost::checked_deleter in your source code:
>
> // Some file
> #include <typeinfo>
> #include <string>
>
> namespace
> {
> std::type_info const & ti =
> typeid( boost::checked_deleter<std::string> );
> }
>
>
> Bear in mind that you can only do this in one source file. Another
> workaround is to use command-line flags to change how the C++ compiler
> generates template instances. One is to use -instances=global, to give
> template instances global linkage (I haven't tested this, it might
> result in duplicate symbols).
>
> Another is to use the undocumented flags "-Qoption CC -xcomdat", which
> switch the compiler to a new linkage mode for templates. This linkage
> mode is the default in the SunONE Studio 8 compiler. This option does
> work, and makes Sun CC's handling of templates much better (no more
> template repository, joy!), but is not supported by Sun until CC 5.5,
> and it is not compatible with some third party tools such as Purify. YMMV.
>
> If none of these options is acceptable to you, I urge you to contact
> your Sun support representative and demand a patch for bug 4878628 for
> Sun CC 5.4. It does not appear that Sun is willing to fix bugs for which
> there are code workarounds, unless customers insist.
>
> Hope this helps,
> Christopher
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk