无法编译boost :: condition_variable cond_

时间:2013-09-12 03:44:30

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

我有一个包含以下内容的课程 -

boost :: condition_varaible 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>

1 个答案:

答案 0 :(得分:3)

你拼写错误condition_variable

boost::condition_varaible cond_;
                    ^^