views:

51

answers:

0

This is definitely going to be one of my more arcane questions, but I hope someone has had to deal with this pain.

I am porting some software to IBM AIX 5.3, using IBM VisualAge C++ 7.0 compiler. The source code depends on boost.asio for networking, and when I was building the code, I got an error from the source:

include/boost/asio/basic_socket.hpp, line 178.45: 1540-0269 (S) "boost::asio::ip::udp" has no default constructor.

To see if it was our code or a compiler issue, I tried to compile the socks4 boost.asio example included with boost source code, and I got the exact same error.

Looking in boost/asio/basic_socket.hpp, this is the offending line:

void open(const protocol_type& protocol = protocol_type())
{
    boost::system::error_code ec;
    this->service.open(this->implementation, protocol, ec);
    boost::asio::detail::throw_error(ec);
}

And looking in the file boost/asio/udp.hpp, the problem VisualAge seems to be complaining about is the fact that the class udp has no default constructor - it only has this private constructor:

private:
  // Construct with a specific family.
  explicit udp(int family)
    : family_(family)
  {
  }

  int family_;

As a quick fix, I put in a public, default constructor like this:

public:
   // Hacky fix, why does VisualAge need this?
   udp()
      : family_(PF_INET)
   { }

And the code compiled just fine, but then ran into other issues that I will have to solve.

I am most curious as to why this is needed - I am fine with hacks and I understand that AIX and this rather old compiler is not really going to be very well supported by boost, but I will do what I have to to deliver this to the customer.

Thanks in advance!

Additional Information

I somehow forgot to mention - I tried compiling the example with the version of GCC 4.2.0 installed on my AIX machine, and it does not throw the error about default constructors.