When I try to build googletest in Windows 10 I can run the cmake command but when I run the make command it results in the errors shown in the additional context.
Steps to reproduce the problem
Tried in Git Bash and cmd:
git clone https://github.com/google/googletest.git -b v1.14.0
cd googletest
mkdir build
cd build
cmake .. -G "MinGW Makefiles"
make
What version of GoogleTest are you using?
v1.14.0
What operating system and version are you using?
Windows 10
What compiler and version are you using?
gcc version 8.1.0 (x86_64-win32-sjlj-rev0, Built by MinGW-W64 project)
What build system are you using?
cmake version 3.28.3
Additional context
Output from the make command:
[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
In file included from C:/mingw64/googletest/googletest/include/gtest/gtest-message.h:57,
from C:/mingw64/googletest/googletest/include/gtest/gtest-assertion-result.h:46,
from C:/mingw64/googletest/googletest/include/gtest/gtest.h:64,
from C:\mingw64\googletest\googletest\src\gtest-all.cc:38:
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1264:8: error: 'mutex' in namespace 'std' does not name a type
std::mutex mu_;
^~~~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1264:3: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:822:1:
+#include
endif // GTEST_IS_THREADSAFE
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1264:3:
std::mutex mu_;
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1265:8: error: 'condition_variable' in namespace 'std' does not name a type
std::conditionvariable cv;
^~~~~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1265:3: note: 'std::condition_variable' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:822:1:
+#include
endif // GTEST_IS_THREADSAFE
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1265:3:
std::conditionvariable cv;
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h: In member function 'void testing::internal::Notification::Notify()':
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:26: error: 'mutex' is not a member of 'std'
std::lockguard lock(mu);
^~~~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:26: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:26: error: 'mutex' is not a member of 'std'
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:26: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:31: error: template argument 1 is invalid
std::lockguard lock(mu);
^
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:38: error: 'mu_' was not declared in this scope
std::lockguard lock(mu);
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1253:5: error: 'cv' was not declared in this scope
cv.notifyall();
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1253:5: note: suggested alternative: 'gcvt'
cv.notify_all();
^~~
gcvt
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:33: warning: unused variable 'lock' [-Wunused-variable]
std::lockguard lock(mu);
^~~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h: In member function 'void testing::internal::Notification::WaitForNotification()':
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:27: error: 'mutex' is not a member of 'std'
std::uniquelock lock(mu);
^~~~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:27: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:27: error: 'mutex' is not a member of 'std'
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:27: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:32: error: template argument 1 is invalid
std::uniquelock lock(mu);
^
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:39: error: 'mu_' was not declared in this scope
std::uniquelock lock(mu);
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1260:5: error: 'cv' was not declared in this scope
cv.wait(lock, [this]() { return notified; });
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1260:5: note: suggested alternative: 'gcvt'
cv.wait(lock, [this]() { return notified_; });
^~~
gcvt
make[2]: [googletest\CMakeFiles\gtest.dir\build.make:76: googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
make[1]: [CMakeFiles\Makefile2:171: googletest/CMakeFiles/gtest.dir/all] Error 2
make: *** [Makefile:145: all] Error 2
Describe the issue
When I try to build googletest in Windows 10 I can run the cmake command but when I run the make command it results in the errors shown in the additional context.
Steps to reproduce the problem
Tried in Git Bash and cmd:
git clone https://github.com/google/googletest.git -b v1.14.0
cd googletest
mkdir build
cd build
cmake .. -G "MinGW Makefiles"
make
What version of GoogleTest are you using?
v1.14.0
What operating system and version are you using?
Windows 10
What compiler and version are you using?
gcc version 8.1.0 (x86_64-win32-sjlj-rev0, Built by MinGW-W64 project)
What build system are you using?
cmake version 3.28.3
Additional context
Output from the
make
command:[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj In file included from C:/mingw64/googletest/googletest/include/gtest/gtest-message.h:57, from C:/mingw64/googletest/googletest/include/gtest/gtest-assertion-result.h:46, from C:/mingw64/googletest/googletest/include/gtest/gtest.h:64, from C:\mingw64\googletest\googletest\src\gtest-all.cc:38: C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1264:8: error: 'mutex' in namespace 'std' does not name a type std::mutex mu_; ^~~~~ C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1264:3: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:822:1:
+#include
endif // GTEST_IS_THREADSAFE
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1264:3: std::mutex mu_; ^~~ C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1265:8: error: 'condition_variable' in namespace 'std' does not name a type std::conditionvariable cv; ^'; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:822:1:
+#include
~~~~~ C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1265:3: note: 'std::condition_variable' is defined in header 'endif // GTEST_IS_THREADSAFE
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1265:3: std::conditionvariable cv; ^~~ C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h: In member function 'void testing::internal::Notification::Notify()': C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:26: error: 'mutex' is not a member of 'std' std::lockguard lock(mu );
^~~~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:26: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:26: error: 'mutex' is not a member of 'std'
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:26: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:31: error: template argument 1 is invalid
std::lockguard lock(mu );
^
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:38: error: 'mu_' was not declared in this scope
std::lockguard lock(mu );
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1253:5: error: 'cv' was not declared in this scope
cv.notifyall();
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1253:5: note: suggested alternative: 'gcvt'
cv.notify_all();
^~~
gcvt
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1251:33: warning: unused variable 'lock' [-Wunused-variable]
std::lockguard lock(mu );
^~~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h: In member function 'void testing::internal::Notification::WaitForNotification()':
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:27: error: 'mutex' is not a member of 'std'
std::uniquelock lock(mu );
^~~~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:27: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:27: error: 'mutex' is not a member of 'std'
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:27: note: 'std::mutex' is defined in header ''; did you forget to '#include '?
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:32: error: template argument 1 is invalid
std::uniquelock lock(mu );
^
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1259:39: error: 'mu_' was not declared in this scope
std::uniquelock lock(mu );
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1260:5: error: 'cv' was not declared in this scope
cv.wait(lock, [this]() { return notified; });
^~~
C:/mingw64/googletest/googletest/include/gtest/internal/gtest-port.h:1260:5: note: suggested alternative: 'gcvt'
cv.wait(lock, [this]() { return notified_; });
^~~
gcvt
make[2]: [googletest\CMakeFiles\gtest.dir\build.make:76: googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
make[1]: [CMakeFiles\Makefile2:171: googletest/CMakeFiles/gtest.dir/all] Error 2
make: *** [Makefile:145: all] Error 2