Search code examples
c++gccboost-thread

program with boost thread 1.51 doesn't build


I am trying to compile a program using boost thread with the latest version. I am using

gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)

With the 1.50 I had an issue saying that the reference to boost::thread::~thrad() couldn't be found. So I updated to the new one I got the following

      /usr/local/include/boost/thread/detail/thread.hpp:65: error: expected ';' before 'thread_data'
      /usr/local/include/boost/thread/detail/thread.hpp:68: error: expected `;' before 'thread_data'
      /usr/local/include/boost/thread/detail/thread.hpp:88: error: expected ';' before 'thread_data'
      /usr/local/include/boost/thread/detail/thread.hpp:91: error: expected `;' before 'void'
      /usr/local/include/boost/thread/detail/thread.hpp:105: error: expected ';' before 'thread_data'
      /usr/local/include/boost/thread/detail/thread.hpp:108: error: expected `;' before 'void'
      /usr/local/include/boost/thread/detail/thread.hpp:121: error: expected ';' before 'private'
      /usr/local/include/boost/thread/detail/thread.hpp:153: error: expected primary-expression before ')' token
      /usr/local/include/boost/thread/detail/thread.hpp:153: error: there are no arguments to 'BOOST_THREAD_RV_REF' that depend on a template parameter, so a declaration of 'BOOST_THREAD_RV_REF' must be available
      /usr/local/include/boost/thread/detail/thread.hpp:153: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
      /usr/local/include/boost/thread/detail/thread.hpp:153: error: expected `)' before 'f'
      /usr/local/include/boost/thread/detail/thread.hpp:153: error: invalid in-class initialization of static data member of non-integral type 'boost::detail::thread_data_ptr'
      /usr/local/include/boost/thread/detail/thread.hpp:153: confused by earlier errors, bailing out

I had no clue why is doing this way. Is there any workaround?


Solution

  • I had this same issue with g++ 4.2.1 on OSX, though I don't think its a compiler issue per se.

    I had previously installed boost libraries and headers installed to /usr/local/lib and /usr/local/include by invoking b2 install. This works on a new installation, but it doesn't correctly overwrite a previous boost installation (I had 1.49). All I had to do was point my build at the boost build directory I was using, or to delete /usr/local/include/boost and run b2 install again. The first time I ran b2 install it only copied the libs which was fast, the second time it took much longer and copied over all the header files.