【问题标题】:Cannot compile boost::condition_variable cond_无法编译 boost::condition_variable cond_
【发布时间】:2013-09-12 03:44:30
【问题描述】:

我有一堂课 -

boost::condition_variable cond_;

当我尝试编译时 -
[rmitra@butterfly boost]$ make EXE=thread_safe_stack
g++ -L /usr/local/lib -lboost_thread -o thread_safe_stack thread_safe_stack.cpp

我收到以下错误 -
thread_safe_stack.cpp:25:错误:命名空间“boost”中的“condition_varaible”未命名类型

thread_safe_stack.cpp:在成员函数'void thread_safe_stack::push(const T&)'中:

thread_safe_stack.cpp:34: 错误:'cond_' 没有在这个范围内声明

thread_safe_stack.cpp:在成员函数'void thread_safe_stack::pop(T&)'中:

thread_safe_stack.cpp:42:错误:“cond_”未在此范围内声明
make: * [exe] 错误 1 ​​

请解释问题是什么。我使用的是 boost 1.54
我的源文件中包含以下标头 -

#include <boost/thread.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/exceptions.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/pthread/condition_variable_fwd.hpp>
#include <iostream>
#include <stack>
#include <iterator>
#include <algorithm>

【问题讨论】:

  • 这就是我的编译方式-
  • g++ -L /usr/local/lib -lboost_thread -o thread_safe_stack thread_safe_stack.cpp

标签: gcc boost compiler-errors conditional inter-process-communicat


【解决方案1】:

你拼错了condition_variable

boost::condition_varaible cond_;
                    ^^

【讨论】:

  • 嗨,卡尔,感谢您在这方面的帮助....我应该知道最好不要在凌晨 1 点工作...
  • 没问题,我希望它能让你畅通无阻。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多