Boost logo

Boost Users :

Subject: Re: [Boost-users] 1.49 header order conflicts on Windows
From: Lars Viklund (zao_at_[hidden])
Date: 2012-06-14 09:16:41


On Wed, Jun 13, 2012 at 07:03:01PM +0000, Davidson, Josh wrote:
> Consider this following simple app:
>
> #include <boost/thread/thread.hpp>
> #include <boost/asio.hpp>
> #include <boost/thread/recursive_mutex.hpp>
>
> If asio.hpp is moved ahead of the thread headers, the error goes away. We've been trying to dictate #include order to work around this problem, but it keeps cropping up.
>

I've got an idea to the root cause here.

The primitives like InterlockedExchange requires a minimum of XP/2003
support, so you need _WIN32_WINNT to be at least 0x501 in order to
target a minimum OS version of XP.

I believe that Asio defines _WIN32_WINNT to a sufficiently high value in
order to get the OS primitives it needs, and as such, implicitly
ensures that the thread code gets them too.

Either Boost.Thread ought to also define this if it's not already
defined, and probably error out hard with a nice message if it's not
targetting a sufficiently fancy Windows version.

-- 
Lars Viklund | zao_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net