Boost logo

Boost Users :

From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-07-24 03:24:08


"Vial, Florent" <fvial_at_[hidden]> writes:

> i was running happily with boost 1.34.0 under Win32, using
> boost::program_options, boost_filesystem, and boost::thread.
> i decided to update to 1.35.0.
> I had to fix some broken code (e.g. boost::filesystem::filesystem_error
> does not have a member system_error() anymore) which was ok.
> Tell me if I am wrong, but now if i want to use a tiny boost::mutex
> (#include <boost/thread/mutex.hpp>),
> not only have I to define WIN32_LEAN_AND_MEAN before the include to
> avoid cryptic error messages due to the inclusion of winsock.h though i
> am using winsock2.h, but also I must now link to boost_thread AND to
> boost_system ? is this right ?

The new Boost.Thread uses Boost.DateTime for timeouts. Boost.DateTime
includes <windows.h>, so you can either define WIN32_LEAN_AND_MEAN to
avoid <windows.h> including <winsock.h>, or you can include
<winsock2.h> before any Boost.Thread headers.

If you are only using boost::mutex, you do not need to link against
the boost.thread library, though the auto-link stuff might try and
force you to. On MSVC you can use the /nodefaultlib:library-name
linker option to stop the linker complaining about a missing library,
or you can just link against it anyway.

Anthony

-- 
Anthony Williams            | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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