vendredi 23 septembre 2016

boost log without multithreading

I was trying to use Boost.Log without multithreading for a while without success. Now I came accross this statement in "configuring an building the library":

The logging library uses several other Boost libraries that require building too. These are [..], Boost.Thread [...]

Is it about building the boost library itself or about building my code?

Here is what I tried:

#define BOOST_LOG_NO_THREADS

#define BOOST_LOG_DYN_LINK
#define BOOST_ALL_DYN_LINK
#include <boost/log/trivial.hpp>

int main() { BOOST_LOG_TRIVIAL(trace) << "TRACE LOG"; }

I compiled it this way:

g++ test.c++ -lboost_log -lboost_log_setup

The first error:

undefined reference to `boost::log::v2_st::trivial::logger::get()'

And then 3/4 of my screen full of errors; I'll post them if needed.

If I compile using -lpthread and without the BOOST_LOG_NO_THREADS definition it compiles fine.

If I use -lpthread without removing BOOST_LOG_NO_THREADS then I get the same errors.
Why?
Can I compile my code without multithreading support?

Aucun commentaire:

Enregistrer un commentaire