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)

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
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
(),
Try
boost::bind<bool>( std::equal_to
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
(), Try
boost::bind<bool>( std::equal_to
(), 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