Opened 6 years ago

Closed 6 years ago

#8287 closed Bugs (invalid)

_WIN32_WINDOWS breaks connect() on XP

Reported by: toby_toby_toby@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.53.0 Severity: Showstopper
Keywords: win32 macro asio Cc:


#define _WIN32_WINDOWS 0x0501 // this macro causes exceptions in main()
// without it works fine. by the way, WINVER 0x0501 works fine
#include <boost/asio.hpp>
int main(int argc, char** argv)
	boost::asio::io_service s;
	boost::asio::deadline_timer dt( s ); // this will throw 
	boost::asio::ip::tcp::acceptor a(s); // or this if you comment timer
	return 0;

I have not updated (since 2002) Windows XP SP3, week-old fresh VS2010, boost 1.44 or 1.53 (both tested - same).

Both deadline_timer and acceptor (and maybe something else) throwing here:

namespace boost {
namespace asio {
namespace detail {

  if (socket_ops::connect(client.get(), (const socket_addr_type*)&addr,
      addr_len, ec) == socket_error_retval)
  boost::asio::detail::throw_error(ec, "socket_select_interrupter");
// error core 10022.

Change History (4)

comment:1 Changed 6 years ago by Anthony K <toby_toby_toby@…>

#define _WIN32_WINNT 0x0501

also works fine, only _WIN32_WINDOWS throws... Sorry if I use it wrong way =)

comment:2 Changed 6 years ago by Anthony K <toby_toby_toby@…>

Problems continued with Win Socket connect() function, it doesn't want to work with same error even without boost, clean project (tested in CodeBlocks? and VS 2010 express), both with MinGW and VisualC (it means different SDK) =(

I took example from here:

Tried different versions: 2.0, 2.1, 2.2

Bad windows probably. But strange, how other applications working, for example browser? =))

comment:3 Changed 6 years ago by Anthony K <toby_toby_toby@…>


comment:4 Changed 6 years ago by chris_kohlhoff

Resolution: invalid
Status: newclosed

BTW, the _WIN32_WINDOWS define is used if you want to target a non-NT version of Windows (e.g. Windows 95, 98 or ME). Don't use it for modern Windows platforms.

Note: See TracTickets for help on using tickets.