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

Reply via email to