Question

I have a class with the following -

boost::condition_varaible cond_;

When I try and compile -
[rmitra@butterfly boost]$ make EXE=thread_safe_stack
g++ -L /usr/local/lib -lboost_thread -o thread_safe_stack thread_safe_stack.cpp

I get the following error -
thread_safe_stack.cpp:25: error: ‘condition_varaible’ in namespace ‘boost’ does not name a type

thread_safe_stack.cpp: In member function ‘void thread_safe_stack::push(const T&)’:

thread_safe_stack.cpp:34: error: ‘cond_’ was not declared in this scope

thread_safe_stack.cpp: In member function ‘void thread_safe_stack::pop(T&)’:

thread_safe_stack.cpp:42: error: ‘cond_’ was not declared in this scope
make: * [exe] Error 1

Please explain what the problem is.. I am using boost 1.54
I have the following headers included in my source file -

#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>
Était-ce utile?

La solution

You're spelling condition_variable wrong:

boost::condition_varaible cond_;
                    ^^
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top