【发布时间】: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