|
Boost : |
From: Brian Oberholtzer (brian.oberholtzer_at_[hidden])
Date: 2003-07-23 17:00:30
A huge thanks Chis,
Is the bug report available on a public Sun website?
* I did try the -instances=global which gave me multiple define errors.
* I can't use option 3 because I'm stuck on 5.4 for now.
I haven't been able to get the first option to resolve the link problem,
although it compiles. I'm using the shared pointers as member variables in
my own classes. I am not defining my own namespaces. Do I need to include
the namespace specifier? Sorry to have these additional questions but I'm
just getting used to templates and shared_ptr is chuck full of 'em.
Thanks,
- Brian
"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