error: 'mutex' is not a member of 'std'

Florian Weimer fweimer@redhat.com
Wed Nov 13 11:34:00 GMT 2013


On 11/13/2013 06:00 AM, net_robber wrote:
> i have built toolchain(gcc 4.8.2 glibc 2.18),
> the new toolchain can build most c/c++ code, but only a certain case is not work
>
> i have  a test case to re-produce the error
>
> test.cpp:
> #include <mutex>
>
> int main(int argc, char** argv)
> {
>          std::mutex m;
>          return 0;
> }
>
> Makefile:
> test.out: test.cpp Makefile
>          ${CXX}  -std=c++11 -c -o $@.o lt;
>          ${CXX} -o $@ $@.o
>
>
> compile error like this
> test.cpp: In function 'int main(int, char**)':
> test.cpp:5:2: error: 'mutex' is not a member of 'std'
>    std::mutex m;
>    ^
> test.cpp:5:13: error: expected ';' before 'm'
>    std::mutex m;

What happens if you compile with -v?  Perhaps it's picking up the wrong 
version of the file from somewhere, so the search paths are of 
particular interest.  The preprocessed sources (-E) might provide hints 
as well.

This question is probably more suited to the gcc-help mailing list.

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Libstdc++ mailing list