D
D
Dolarun2022-02-13 10:47:55
C++ / C#
Dolarun, 2022-02-13 10:47:55

Why does c std::mutex error occur during makefile gtest?

Here is the error output:

PS C:\Users\79306\Documents\GitHub\2DPrimitiveLib\tests><i> mingw32-make</i>
[ 16%] Building CXX object tests/googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
In file included from C:/Users/79306/Documents/GitHub/2DPrimitiveLib/tests/googletest/googletest/include/gtest/gtest-message.h:55:0,
                 from C:/Users/79306/Documents/GitHub/2DPrimitiveLib/tests/googletest/googletest/include/gtest/gtest-assertion-result.h:46,
                 from C:/Users/79306/Documents/GitHub/2DPrimitiveLib/tests/googletest/googletest/include/gtest/gtest.h:59,
                 from C:\Users\79306\Documents\GitHub\2DPrimitiveLib\tests\googletest\googletest\src\gtest-all.cc:38:
C:/Users/79306/Documents/GitHub/2DPrimitiveLib/tests/googletest/googletest/include/gtest/internal/gtest-port.h:1244:8: error: 'mutex' in namespace 'std' does not name a type
   std::mutex mu_;
        ^~~~~
...

Then everything also breaks down, probably because of the first breakdown (c std::mutex).
I tried to build a makefile with Cmake-a with the gtest_disable_pthreads flag, but the errors continue to fly out:
6208b670cf163408516646.png
I installed pthreads from the batch installer, but it still does not work.
Here are the CMake settings:
6208b6df2fa3a953224706.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2022-02-13
@Dolarun

C++ compiler retired, or not configured C++ >= C++11
- check if compiler is new (GCC 11 or Clang 12)
- add flag -std=c++17

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question