BCB6.0编译boost 1.39.0的thread库


问题
在BCB6.0下编译
使用如下指令编译boost 1.39.0的thread库,使用如下指令
bjam --toolset=borland-6.0 --with-thread stage debug threading=multi link=shared
进行编译,将出现如下错误:
[C++ Error] thread.hpp(344): E2247 'thread::thread(thread &)' is not accessible
提示为thread::thread(thread &)收到保护,不可访问。


解决办法
修改源码,将thread::thread(thread &)方法的访问限制改为public。
打开文件V:\boost\boost_1_39_0\boost\thread\detail\thread.hpp
定位108行代码,如下
    class BOOST_THREAD_DECL thread
    {
    private:
        //thread(thread&);
        thread& operator=(thread&);
将thread(thread&);方法注释,并将该方法的声明放到public处,如代码146行,如下
    public:
        thread();
        ~thread();
        thread(thread&);

备注:编译开源项目,不到万不得已最好不要去修改源码。

相关内容