Boost logo

Boost :

From: hugo_duncan (hugo.duncan_at_[hidden])
Date: 2002-02-08 13:25:48


weak_ptr looks to be very useful, but I am having problems compiling operator-> and operator* on bcc32.

The following code does not compile

#include "boost/weak_ptr.hpp"
#include <cassert>

class X
{
public:
  int a;
};

void weak_ptr_test()
{
  boost::shared_ptr<X> x;
  boost::weak_ptr<X> y(x);
  assert(x->a==y->a);
  assert((*x).a==(*y).a);
}

The error messages are:

Error E2451 c:\usr\boost\boost/weak_ptr.hpp 120: Undefined symbol 'T' in function weak_ptr<X>::operator ->() const
Error E2451 c:\usr\boost\boost/weak_ptr.hpp 120: Undefined symbol 'p' in function weak_ptr<X>::operator ->() const
Error E2451 c:\usr\boost\boost/weak_ptr.hpp 113: Undefined symbol 'T' in function weak_ptr<X>::operator *() const
Error E2451 c:\usr\boost\boost/weak_ptr.hpp 113: Undefined symbol 'p' in function weak_ptr<X>::operator *() const
*** 4 errors in Compile ***

I don't see anything wrong with the code. get() does however work, and could be used as a workaround?

Hugo


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