I have the following code:
#include <vector>
#include <string>
#include <mutex>
#include <queue>
std::mutex queue_mutex;
std::condition_variable condition;
int main(int argc, char** argv)
{
return 0;
}
When compiling it on Windows, I have no problems, but once I do on Unix it does.
I first tried compiling with:
g++ -O3 -Wall tester.cpp -lpthread -o tester
But I get the following error:
In file included from /usr/include/c++/4.8/mutex:35:0,
from gamytester.cpp:7:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
gamytester.cpp:10:2: error: ‘mutex’ in namespace ‘std’ does not name a type
std::mutex queue_mutex_;
^
gamytester.cpp:11:2: error: ‘condition_variable’ in namespace ‘std’ does not name a type
std::condition_variable condition_;
So I tried to compile it using
g++ -O3 -Wall -std=c++11 tester.cpp -lpthread -o tester
Which still lead me to another error:
gamytester.cpp:11:2: error: ‘condition_variable’ in namespace ‘std’ does not name a type
std::condition_variable condition_;
^
I'm running openSUSE 13.02 and have the g++ compiler version 4.8.3.
Does anybody know how to help me?