|
Boost : |
Subject: Re: [boost] [chrono] Header only library build and boost::system dependency
From: Edward Diener (eldiener_at_[hidden])
Date: 2016-05-04 06:06:02
On 5/4/2016 1:17 AM, Vicente J. Botet Escriba wrote:
> Le 04/05/2016 06:05, Edward Diener a écrit :
>> The documentation for chrono says:
>>
>> "How to Build Boost.Chrono as a Header Only Library?
>>
>> When BOOST_CHRONO_HEADER_ONLY is defined the lib is header-only.
>>
>> If in addition BOOST_USE_WINDOWS_H is defined <windows.h> is included,
>> otherwise files in boost/detail/win are used to reduce the impact of
>> including <windows.h>.
>>
>> However, you will either need to define
>> BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING or link with
>> Boost.System. "
>>
>> So I have:
>>
>> #define BOOST_CHRONO_HEADER_ONLY
>> #define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
>> #include <boost/chrono.hpp>
>>
>> followed by some code using chrono, and I still get when linking my exe:
>>
>> gcc.link
>> C:\Programming\VersionControl\modular-boost\build\boost\bin.v2\libs\cxx_dual\test\test_chrono.test\gcc-mingw-5.3\debug\test_chrono.exe
>>
>> C:\Programming\VersionControl\modular-boost\build\boost\bin.v2\libs\cxx_dual\test\test_chrono.test\gcc-mingw-5.3\debug\test_chrono.o:
>> In function `_static_initialization_and_destruction_0':
>> E:\Programming\VersionControl\modular-boost\libs\cxx_dual\test/../../../boost/system/error_code.hpp:221:
>> undefined reference to `boost::system::generic_category()'
>> E:\Programming\VersionControl\modular-boost\libs\cxx_dual\test/../../../boost/system/error_code.hpp:222:
>> undefined reference to `boost::system::generic_category()'
>> E:\Programming\VersionControl\modular-boost\libs\cxx_dual\test/../../../boost/system/error_code.hpp:223:
>> undefined reference to `boost::system::system_category()'
>> collect2.exe: error: ld returned 1 exit status
>>
>> Is there a way to use chrono without having to link boost::system ?
>>
>>
> Hi,
>
> Please fill a Trac ticket so that I don't forget to check this.
I will do that if I can't figure out a PR.
>
> Coud you try to replace in boost/chrono/detail/system.hpp:
>
> #include <boost/system/error_code.hpp>
>
> with
>
> #if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING
> #include <boost/system/error_code.hpp>
> #endif
It's not from boost/chrono/detail/system.hpp. Everything in there is
already protected by:
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
which I am defining according to the doc instructions.
>
>
> I will come to you on a week.
>
> Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk