升压1.44.0 + VS2010私有成员错误 [英] Boost 1.44.0 + VS2010 Private member error

查看:75
本文介绍了升压1.44.0 + VS2010私有成员错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Utils.h类声明:

I have a class declaration in Utils.h:

    class Utils {
 private:
     static boost::mutex outputMutex;
    };

在cpp文件:

boost::mutex Utils::outputMutex = boost::mutex();

我得到:

Error 1 error C2248: 'boost::mutex::mutex' : cannot access private member declared in class 'boost::mutex'

如果我们看看升压/线程/ win32目录/ mutex.hpp内我们看到:

If we look inside boost/thread/win32/mutex.hpp we see:

namespace boost
{   
    class mutex:
        public ::boost::detail::underlying_mutex
    {

    // ...       

    public:
        mutex()
        {
            initialize();
        }

有谁知道我在这里失踪?它用于编译OK了不同的机器上使用VS2008。

Does anyone know what I'm missing here? It used to compile OK on a different machine with VS2008.

感谢您。

推荐答案

.cpp文件应该是:

The .cpp file should be:

boost::mutex Utils::outputMutex;

有没有需要的分配。它会被适当地构造。

There's no need for an assignment. It will be constructed appropriately.

这篇关于升压1.44.0 + VS2010私有成员错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆