Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-12-30 12:05:05


From: <cmwong_at_[hidden]>
> Hi,
>
> I was trying to compile the following code using VC++ .NET.
>
> #include "stdafx.h"
> #include "boost/smart_ptr.hpp"
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> boost::shared_ptr<int> spc = new int(0);

This should be

boost::shared_ptr<int> spc(new int(0));

but it's not the source of the problem.

> return 0;
> }
>
> I got the following error messages:
>
> c:\boost\smart_ptr.hpp(375) : error C2065: 'T' : undeclared identifier
[...]
> The offending code in smart_ptr.hpp is:
> template<typename T>
> struct less< boost::shared_ptr<T > > //..... LINE 375
> : binary_function<boost::shared_ptr<T>, boost::shared_ptr<T>,
> bool>

You are using an early version of Boost that doesn't know about VC++.NET
(since it was released before the compiler.) Newer releases work with VC++
7. If you don't want to upgrade Boost, try simply removing the less<>
specialization from smart_ptr.hpp.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net