boost bind conflicting with socket bind
Hello, My Socket code that contains call to "bind" to a port is conflicting with boost::bind in 1.36. It compiles fine under boost 1.34 and 1.35. Interestingly, nothing is included from boost in that file. I am using boost with mingw on Win Xp. The code snippet is as follows: int Socket::BindPort(int family, int address, int port) { sockaddr_in sa; int dwError = RERROR_SUCCESS; memset(&sa, 0, sizeof(sa)); sa.sin_family = family; sa.sin_addr.s_addr = address; sa.sin_port = htons(port); if (bind(s_, (sockaddr *)&sa, sizeof(sockaddr_in)) == SOCKET_ERROR) { dwError = RERROR_SOCKET_BIND_ERROR; LOG (LOG_ERR, "Could not bind socket to port %u", port); BAIL_ON_ERROR (dwError); } error: return dwError; } Here is what I am getting... [g++] [Socket.o]<-[Socket.cpp] E:/msys/1.0/boost/boost_1_36_0/boost/bind.hpp: In instantiation of `boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>': E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:15: instantiated from `boost::_bi::bind_t<boost::_bi::unspecified, unsigned int, boost::_bi::list2<boost::_bi::value<sockaddr*>, boost::_bi::value<unsigned int> > >' Socket.cpp:98: instantiated from here E:/msys/1.0/boost/boost_1_36_0/boost/bind.hpp:67: error: `unsigned int' is not a class, struct, or union type E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp: In instantiation of `boost::_bi::bind_t<boost::_bi::unspecified, unsigned int, boost::_bi::list2<boost::_bi::value<sockaddr*>, boost::_bi::value<unsigned int> > >': Socket.cpp:98: instantiated from here E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:15: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:18: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:24: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:30: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:36: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:45: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:51: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:59: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:65: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:74: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:80: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:87: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>' E:/msys/1.0/boost/boost_1_36_0/boost/bind/bind_template.hpp:93: error: no type named `type' in `struct boost::_bi::result_traits<boost::_bi::unspecified, unsigned int>'
Sharad Mittal:
Hello, My Socket code that contains call to "bind" to a port is conflicting with boost::bind in 1.36. It compiles fine under boost 1.34 and 1.35. Interestingly, nothing is included from boost in that file. I am using boost with mingw on Win Xp.
The code snippet is as follows: ...
if (bind(s_, (sockaddr *)&sa, sizeof(sockaddr_in)) == SOCKET_ERROR) {
I don't know why this call chooses to call boost::bind instead of the socket bind; it may have something to do with the type of s_. Either way, you should be able to fix it by using ::bind instead of just bind. -- Peter Dimov http://www.pdplayer.com
participants (2)
-
Peter Dimov
-
Sharad Mittal