Hi,
I would like to share my experience with boost when
combining with c++11. I hope it might help someone.
Suppose a simple program:
#include
<boost/asio.hpp>
#include <iostream>
using
boost::asio::detail::atomic_count;
struct Test
{
// Whether the task has
been interrupted.
bool
task_interrupted_;
// The
count of unfinished work.
atomic_count
outstanding_work_;
};
int main ()
{
std::cout <<
"Size is " << sizeof(Test) << std::endl;
return 0;
}
And here is the story:
$ /opt/gcc-4.8.4/bin/g++ -std=c++11 -I
/opt/boost-1.58.0/include/ -L /opt/boost-1.58.0/lib
-lboost_system b.cpp
$ ./a.out
Size is 16
$ /opt/gcc-4.8.4/bin/g++ -I /opt/boost-1.58.0/include/ -L
/opt/boost-1.58.0/lib -lboost_system b.cpp
$ ./a.out
Size is 8
It means that c++11 program cannot be linked with boost
libraries compiled without "-std=c++11" option. It was asio in
my case and the program was linked with
libboost_log.so.1.58.0.