From:
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
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.