程序与提升线程1.51不构建

时间:2012-08-22 10:40:54

标签: c++ gcc boost-thread

我正在尝试使用最新版本的boost线程编译程序。我正在使用

gcc版本4.1.2 20080704(Red Hat 4.1.2-52)

对于1.50,我遇到了一个问题,即无法找到对boost::thread::~thrad()的引用。所以我更新到了新版本,我得到了以下内容

      /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

我不知道为什么这样做。有没有解决方法?

1 个答案:

答案 0 :(得分:2)

我在OSX上遇到了与g ++ 4.2.1相同的问题,尽管我认为它本身并不是编译器问题。

我以前通过调用b2 install安装了/usr/local/lib/usr/local/include安装的boost库和标头。这适用于新安装,但它没有正确覆盖以前的boost安装(我有1.49)。我所要做的就是将我的构建指向我正在使用的boost构建目录,或删除/usr/local/include/boost并再次运行b2 install。我第一次运行b2安装它只复制了快速的库,第二次花了很长时间并复制了所有的头文件。