I came across this error message, and post a few years later and while building clang-tidy for AIX.
It turns out that <mutex> doesn't define std::mutex if g++ doesn't have the "-pthread" argument.
The help for the command line option says as much Preprocessor Options Help - GCC:
pthread
Define additional macros required for using the POSIX threads library. You should use this option consistently for both compilation and linking. This option is supported on GNU/Linux targets, most other Unix derivatives, and also on x86 Cygwin and MinGW targets.
------------------------------
John Cuningham
------------------------------
Original Message:
Sent: Tue October 02, 2018 10:51 AM
From: Archive User
Subject: error: 'mutex' in namespace 'std' does not name a type
Originally posted by: amandeepgautam
I am trying to compile grpc on AIX. After fixing a few GCC8 warnings, I run into the following error:
In file included from include/grpcpp/impl/codegen/call.h:30,
from include/grpcpp/impl/call.h:22,
from include/grpcpp/channel.h:25,
from src/cpp/client/insecure_credentials.cc:23:
include/grpcpp/impl/codegen/client_context.h:419:8: error: 'mutex' in namespace 'std' does not name a type
std::mutex mu_;
^~~~~
include/grpcpp/impl/codegen/client_context.h:419:3: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
include/grpcpp/impl/codegen/client_context.h:53:1:
+#include <mutex>
include/grpcpp/impl/codegen/client_context.h:419:3:
std::mutex mu_;
^~~ The following stackoverflow post gives some context:
https://stackoverflow.com/questions/14191566/c-mut...
However I am not sure why this is happening on AIX. Is it because of a similar problem? Is there a known workaround?
#AIX-Forum