Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2003-10-30 16:53:59


On Oct 30, 2003, at 12:52 PM, John Maddock wrote:
>> /usr/bin/ld: Undefined symbols:
>> B<int>::zero_
>> collect2: ld returned 1 exit status
>>
>> This causes problems with the uBlas sparse matrices. Sometimes a
>> workaround, explicitly defining the static member a second time will
>> work.
>
> I think that's a related problem to:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11026
>
> It's been classified as a request for a new feature - apparently gcc on
> apple has never supported weak symbols so static data members of
> templates
> never get instantiated :-(
>
> However using a getter function should work:
>
> template<class T>
> class B : public A<B<T> > {
> public:
> T f() const
> {
> static const T zero_;
> return zero_;
> }
> };

Indeed, it is related to that bug. Maybe uBlas could use such a getter
function instead of a static member variable for zero_?

Matthias


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