OK solved, missing 2 things:

a) defined Windows version: added -D_WIN32_WINNT=0x0501 -DWINVER=0x0501
  for a list of Windows version: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx

b) To solve the "undefined reference to `WSAStartup@8'" errors, added the library wsock32  (ie: -lwsock32)

Vincent

2012/8/3 Vincent <vincentb1981@gmail.com>
Dear Boost'ers,

I'm facing compilation troubles while using boost::asio for asynchronous timers. Including the asio.hpp header raises compilation error on Windows (Windows 7 64 bits) but not on GNU/Linux & Mac OS X:

#include <boost/asio.hpp>

main error messages (full error output below):

..\Tools\boost\current\boost\asio\detail\impl\win_object_handle_service.ipp:109: error: '::UnregisterWaitEx' has not been declared

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:379: error: 'RegisterWaitForSingleObject' was not declared in this scope


I tried either with a complete project (via qmake + Qt Creator), either with a "hello world" example compiled with g++ (mingw under the hood):

g++ testasio.cpp -I..\Tools\boost\current -L..\Tools\boost\current\stage\lib -lboost_system-mgw44-mt-1_49 -D_WIN32_WINDOWS

Where the source code example is copy-pasted from "Timer asynchrone" (it's in french but the code is universal ;-)  )
http://gwenael-dunand.developpez.com/tutoriels/cpp/boost/asio/#LIII-B

Thanks,

Vincent

Full g++ output:

In file included from ..\Tools\boost\current/boost/asio/detail/win_object_handle_service.hpp:180,

from ..\Tools\boost\current/boost/asio/windows/object_handle_service.hpp:24,

from ..\Tools\boost\current/boost/asio/windows/basic_object_handle.hpp:27,

from ..\Tools\boost\current/boost/asio.hpp:99,


..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp: In member function 'void boost::asio::detail::win_object_handle_service::move_construct(boost::asio::detail::win_object_handle_service::implementation_type&, boost::asio::detail::win_object_handle_service::implementation_type&)':

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:109: error: '::UnregisterWaitEx' has not been declared

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp: In member function 'void boost::asio::detail::win_object_handle_service::move_assign(boost::asio::detail::win_object_handle_service::implementation_type&, boost::asio::detail::win_object_handle_service&, boost::asio::detail::win_object_handle_service::implementation_type&)':

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:161: error: '::UnregisterWaitEx' has not been declared

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp: In member function 'void boost::asio::detail::win_object_handle_service::destroy(boost::asio::detail::win_object_handle_service::implementation_type&)':

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:203: error: '::UnregisterWaitEx' has not been declared

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp: In member function 'boost::system::error_code boost::asio::detail::win_object_handle_service::close(boost::asio::detail::win_object_handle_service::implementation_type&, boost::system::error_code&)':

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:254: error: '::UnregisterWaitEx' has not been declared

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp: In member function 'boost::system::error_code boost::asio::detail::win_object_handle_service::cancel(boost::asio::detail::win_object_handle_service::implementation_type&, boost::system::error_code&)':

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:305: error: '::UnregisterWaitEx' has not been declared

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp: In member function 'void boost::asio::detail::win_object_handle_service::register_wait_callback(boost::asio::detail::win_object_handle_service::implementation_type&, boost::asio::detail::scoped_lock<boost::asio::detail::win_mutex>&)':

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:379: error: 'RegisterWaitForSingleObject' was not declared in this scope

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp: In static member function 'static void boost::asio::detail::win_object_handle_service::wait_callback(void*, BOOLEAN)':

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:405: error: '::UnregisterWaitEx' has not been declared

..\Tools\boost\current/boost/asio/detail/impl/win_object_handle_service.ipp:421: error: 'RegisterWaitForSingleObject' was not declared in this scope