Is boost compilation supported with VC 7.0 (Visual Studio 2002)?

Hi, All, I am having troubles to compile libtorrent 0.9.1 which depends on boost 1.33+. From the error messages, boost does not work very well with Visual Studio 2002. What puzzles me more is that if I just build the boost alone by invoking bjam in the boost directory, I still can not build the whole library because of the spirit section; but all the errors as reported below does not appear. This seems to indicate some compiler options issues. Is there any successful story that you can share with me with regards to VC 7.0 compilation? Any pointers are welcome. The errors I have seem so far at enclosed at the end. The libtorrent only depends on boost:filesystem, boost:date_time and boost::thread. Best regards, Allen Zhao -------------------------- Following are some of the messages related to boost: 1) <boost\filesystem\operations.hpp>'s BOOST_OPERATOR_TEMPLATE definition: msvc.compile.c++ bin\msvc\debug\threading-multi\allocate_resources.obj allocate_resources.cpp C:\boost_1_33_1\boost\filesystem\operations.hpp(56) : error C2955: 'boost::equivalent' : use of class template requires template argument list C:\boost_1_33_1\boost\operators.hpp(820) : see declaration of 'boost::equivalent' call "C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat" > nul cl /Zm800 -nologo -TP /Z7 /Od /Ob0 /GR /MDd /wd4675 /EHs /Zc:forScope /Zc:wchar_t @"bin\msvc\debug\threading-multi\allocate_resources.obj.rsp" -c -Fo"bin\msvc\debug\threading-multi\allocate_resources.obj" && del /f "bin\msvc\debug\threading-multi\allocate_resources.obj.rsp" ...failed msvc.compile.c++ bin\msvc\debug\threading-multi\allocate_resources.obj... 2) boost::bind(std::less<int>(), _1, 0)) (libtorrent/src/session.cpp) msvc.compile.c++ bin\msvc\debug\threading-multi\session.obj session.cpp src\session.cpp(1613) : error C2780: 'boost::_bi::bind_t<R,boost::_mfi::dm<R,T>,boost::_bi::list_av_1<R>::type> boost::bind(R T::* ,A1)' : expects 2 arguments - 3 provided C:\boost_1_33_1\boost\bind.hpp(1616) : see declaration of 'boost::bind' src\session.cpp(1613) : error C2780: 'boost::_bi::bind_t<R,boost::_mfi::cmf8<R,T,B1,B2,B3,B4,B5,B6,B7,B8>,boost::_bi::list_av_9<R,T,B1,B2,B3,B4,B5,B6,B7>::type> boost::bind(R (__thiscall T::* )(B1,B2,B3,B4,B5,B6,B7,B8) const,A1,A2,A3,A4,A5,A6,A7,A8,A9)' : expects 10 arguments - 3 provided .... 3) msvc.compile.c++ bin\msvc\debug\threading-multi\storage.obj storage.cpp C:\boost_1_33_1\boost\lambda\detail\arity_code.hpp(61) : error C2065: 'T' : undeclared identifier C:\boost_1_33_1\boost\lambda\detail\arity_code.hpp(61) : error C2687: cannot define a nested UDT of a template class out of line C:\boost_1_33_1\boost\lambda\detail\arity_code.hpp(61) : fatal error C1903: unable to recover from previous error(s); stopping compilation call "C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat" > nul cl /Zm800 -nologo -TP /Z7 /Od /Ob0 /GR /MDd /wd4675 /EHs /Zc:forScope /Zc:wchar_t @"bin\msvc\debug\threading-multi\storage.obj.rsp" -c -Fo"bin\msvc\debug\threading-multi\storage.obj" && del /f "bin\msvc\debug\threading-multi\storage.obj.rsp" ...failed msvc.compile.c++ bin\msvc\debug\threading-multi\storage.obj... 4) src\torrent.cpp(218) : error C2065: 'complete' : undeclared identifier C:\boost_1_33_1\boost\tuple\detail\tuple_basic_no_partial_spec.hpp(471) : error C2039: 'map_tuple_to_cons' : is not a member of 'boost::detail' src\torrent.cpp(476) : see reference to class template instantiation 'boost::tuple<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>' being compiled with [ T1=libtorrent::size_type, T2=libtorrent::size_type, T3=boost::tuples::null_type, T4=boost::tuples::null_type, T5=boost::tuples::null_type, T6=boost::tuples::null_type, T7=boost::tuples::null_type, T8=boost::tuples::null_type, T9=boost::tuples::null_type, T10=boost::tuples::null_type ]

Is there any successful story that you can share with me with regards to VC 7.0 compilation? Any pointers are welcome. The errors I have seem so far at enclosed at the end. The libtorrent only depends on boost:filesystem, boost:date_time and boost::thread.
Looking at the error messages it appears that libtorrent depends on lambda, operators, bind and possibly other Boost libraries as well. At least one of those (lambda) is *very unlikely* to work with VC 7.0. So my guess is that libtorrent needs VC 7.1 or later, but that's really a question for it's authors. HTH John.

Thanks for the message. But I still believe at least some of these should be fixable. For example, the first one: <---- error message begin ----> msvc.compile.c++ bin\msvc\debug\threading-multi\allocate_resources.obj allocate_resources.cpp C:\boost_1_33_1\boost\filesystem\operations.hpp(56) : error C2955: 'boost::equivalent' : use of class template requires template argument list C:\boost_1_33_1\boost\operators.hpp(820) : see declaration of 'boost::equivalent' call "C:\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat" > nul cl /Zm800 -nologo -TP /Z7 /Od /Ob0 /GR /MDd /wd4675 /EHs /Zc:forScope /Zc:wchar_t @"bin\msvc\debug\threading-multi\allocate_resources.obj.rsp" -c -Fo"bin\msvc\debug\threading-multi\allocate_resources.obj" && del /f "bin\msvc\debug\threading-multi\allocate_resources.obj.rsp" <---- error message end ----> If I look at C:\boost_1_33_1\boost\filesystem\operations.hpp, line 56, it defines BOOST_OPERATOR_TEMPLATE(equivalent) But in C:\boost_1_33_1\boost\operators.hpp, line 820 BOOST_FILESYSTEM_DECL bool equivalent( const path & ph1, const path & ph2 ); So there are 2 equivalent, one defined in boost::filesystem, and one in global as a macro. The allocate_resources.cpp does invoke any 'equivalent', it is just simple header conflict, either in libtorrent's declaration, or within boost. If I comments out line 56 in boost/operators.hpp for the "BOOST_OPERATOR_TEMPLATE(equivalent)", then all the related error disappear. The question is if it is the right thing to do. Well, I am really new to boost and libtorrent, and really have no feeling about this at all. With regard to the boost:bind problem, I am not sure what happened. BTW, anyone knows the equalivalent form for the following nested bind: struct peer { enum connection_type { not_connectable,connectable }; peer(const address& ip, connection_type t); ... peer_connection* connection; }; std::vector<peer> m_peers; peer_connection& c; assert(std::find_if(m_peers.begin(), m_peers.end() , boost::bind(std::equal_to<peer_connection*>(), boost::bind(&peer::connection, _1) , &c)) != m_peers.end()); I am trying to invoke the predicate std:equal_to() directly, therefore remove the first boost::bind().. Best regards, Allen Zhao John Maddock wrote:
Is there any successful story that you can share with me with regards to VC 7.0 compilation? Any pointers are welcome. The errors I have seem so far at enclosed at the end. The libtorrent only depends on boost:filesystem, boost:date_time and boost::thread.
Looking at the error messages it appears that libtorrent depends on lambda, operators, bind and possibly other Boost libraries as well. At least one of those (lambda) is *very unlikely* to work with VC 7.0. So my guess is that libtorrent needs VC 7.1 or later, but that's really a question for it's authors.
HTH John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Allen Zhao wrote:
With regard to the boost:bind problem, I am not sure what happened. BTW, anyone knows the equalivalent form for the following nested bind:
struct peer { enum connection_type { not_connectable,connectable };
peer(const address& ip, connection_type t); ... peer_connection* connection; };
std::vector<peer> m_peers; peer_connection& c;
assert(std::find_if(m_peers.begin(), m_peers.end() , boost::bind(std::equal_to<peer_connection*>(),
Try boost::bind<bool>( std::equal_to<peer_connection*>(),
boost::bind(&peer::connection, _1) , &c)) != m_peers.end());
or possibly boost::bind( &peer::connection, _1 ) == &c
I am trying to invoke the predicate std:equal_to() directly, therefore remove the first boost::bind()..

Thank you so much, Peter. Both suggested fixes works! Add a return type also resolves several other errors as well. Best regards, Allen Zhao Peter Dimov wrote:
Allen Zhao wrote:
With regard to the boost:bind problem, I am not sure what happened. BTW, anyone knows the equalivalent form for the following nested bind:
struct peer { enum connection_type { not_connectable,connectable };
peer(const address& ip, connection_type t); ... peer_connection* connection; };
std::vector<peer> m_peers; peer_connection& c;
assert(std::find_if(m_peers.begin(), m_peers.end() , boost::bind(std::equal_to<peer_connection*>(),
Try
boost::bind<bool>( std::equal_to<peer_connection*>(),
boost::bind(&peer::connection, _1) , &c)) != m_peers.end());
or possibly
boost::bind( &peer::connection, _1 ) == &c
I am trying to invoke the predicate std:equal_to() directly, therefore remove the first boost::bind()..
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Allen Zhao wrote:
2) boost::bind(std::less<int>(), _1, 0)) (libtorrent/src/session.cpp)
You can make this compile on VC 7.0 by providing a return type: boost::bind<bool>(std::less<int>(), _1, 0) http://www.boost.org/libs/bind/bind.html#with_function_objects http://www.boost.org/libs/bind/bind.html#Q_forms http://www.boost.org/libs/bind/bind.html#err_short_form
participants (3)
-
Allen Zhao
-
John Maddock
-
Peter Dimov