I am new to c++ and I am trying to create a lock free queue in c++98 using the boost library (version 1.53). When I compile my code in c++98 I get the following error:
error: ‘q’ was not declared in this scope
boost::lockfree::queue<T *, boost::lockfree::capacity<SIZE>> q;
When I remove the capacity option (boost::lockfree::capacity) the error appears to disappear. What am I missing here and doing wrong?
The line that causes the error exists by itself within the constructor and is as follows:
boost::lockfree::queue<T *, boost::lockfree::capacity<SIZE>> q;
Before C++11, <<
or >>
in any place (including templates argument list) would be interpreted as operator. You need to separate every bracket with a space:
boost::lockfree::queue<T *, boost::lockfree::capacity<SIZE> > q;
With C++11 or later, your original line should compile as-is.