Skip to content

Instantly share code, notes, and snippets.

@ofosos
Created March 10, 2018 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ofosos/6d780a488b350b5f1e71f0b9c3982590 to your computer and use it in GitHub Desktop.
Save ofosos/6d780a488b350b5f1e71f0b9c3982590 to your computer and use it in GitHub Desktop.
GCC fails to compile stdlib stuff for C++ 11
mark@thukydides ~$ c++ -O2 -Wall -std=c++11 -lpthread -c test.cpp
test.cpp: In function ‘int main()’:
test.cpp:10:3: error: ‘mutex’ is not a member of ‘std’
std::mutex foo;
^
#include <thread>
#include <mutex>
int main()
{
int n[] = {4,7,6,1,2};
int r;
auto f = [&](int j) { r = j; };
std::mutex foo;
for (auto i : n)
f(i);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment