[chrono] Header only library build and boost::system dependency
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
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
is included, otherwise files in boost/detail/win are used to reduce the impact of including . 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
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.
Coud you try to replace in boost/chrono/detail/system.hpp:
#include
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
is included, otherwise files in boost/detail/win are used to reduce the impact of including . 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
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
with
#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING #include
#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
On 5/4/2016 1:17 AM, Vicente J. Botet Escriba wrote:
Le 04/05/2016 06:05, Edward Diener a écrit : skipped... Hi,
Please fill a Trac ticket so that I don't forget to check this.
I filed a Trac ticket at https://svn.boost.org/trac/boost/ticket/12176.
Coud you try to replace in boost/chrono/detail/system.hpp:
#include
with
#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING #include
#endif I will come to you on a week.
Vicente
On Wed, 4 May 2016, Edward Diener wrote:
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 ?
BOOST_SYSTEM_NO_DEPRECATED ? I don't understand how this hasn't been made the default yet... -- Marc Glisse
On 5/4/2016 1:26 AM, Marc Glisse wrote:
On Wed, 4 May 2016, Edward Diener wrote:
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 ?
BOOST_SYSTEM_NO_DEPRECATED ? I don't understand how this hasn't been made the default yet...
Defining BOOST_SYSTEM_NO_DEPRECATED worked in my code. Perhaps the chrono documentation just needs to be updated to specify that BOOST_SYSTEM_NO_DEPRECATED needs to be defined also in order not to link boost::system.
participants (3)
-
Edward Diener
-
Marc Glisse
-
Vicente J. Botet Escriba