Getting Chrono C ++ Library (Boost :: sandbox) to work

I wanted to try Chrono from the Boost sandbox. It seems to support a lot of things and should be stable.

I have Boost in version 1.44 installed on my system (including boost_system lib, which is necessary) and took the sandbox version (the download version is older and skips, for example, the ratio.hpp file).

But it does not compile. Trying to compile a simple example from the documentation, with a boost_system binding (in scons with LIBS = ['boost_system']), the following error occurs every time:

obj/main.o: In function `main':
/home/***/src/main.cpp:34: undefined reference to `boost::chrono::system_clock::now()'
scons: building terminated because of errors.

This seems like a linker error. What have I done wrong? I have boost_system in version 1.44 related (using scroll) and have already tried the same with the old version 1.40.

Any tips? How did you customize your use of chrono?

Thank.

Sascha

Edit: This thread , which talks about compatibility issues, allows me to think that the Chrono sandbox version should be able to work with a boost of 1.44.

+3
source share
1 answer

As described in the Installation Chrono documentation , you need to either build and link the Chrono library, or define it BOOST_CHRONO_INLINED.

I am having trouble building Chrono from a trunk check, but this is probably due to the type_traits incompatibility mentioned in the Chrono docs.

SConstruct ( ):

env = Environment(
    CPPDEFINES = ['BOOST_CHRONO_INLINED'],
    CPPPATH = ['/.../boost_1_44_0', ],
    LIBPATH = ['/.../boost_1_44_0/stage/lib', ],
    LIBS = ['boost_system'],
)

env.Program('chrono-test', 'main.cpp')
+1

Source: https://habr.com/ru/post/1779604/


All Articles