Forum: PC-Programmierung google test installieren wíndows 10


von Marc (Gast)


Lesenswert?

Hi,

ich habe C-Code, den ich gerne mit Unittests abdecken möchte.
Dazu wollte ich mir googletest und hippomocks installieren. Beim 
ersteren habe ich aber schon probleme
in
C:\MinGW
habe ich googletest von github geclont.
In diesem habe ich einen ordner Build erstellt
C:\MinGW\googletest\build
1
$ cmake -G "MinGW Makefiles" ..
2
-- The C compiler identification is GNU 8.2.0
3
-- The CXX compiler identification is GNU 8.2.0
4
-- Detecting C compiler ABI info
5
-- Detecting C compiler ABI info - done
6
-- Check for working C compiler: C:/MinGW/bin/gcc.exe - skipped
7
-- Detecting C compile features
8
-- Detecting C compile features - done
9
-- Detecting CXX compiler ABI info
10
-- Detecting CXX compiler ABI info - done
11
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe - skipped
12
-- Detecting CXX compile features
13
-- Detecting CXX compile features - done
14
-- Found Python: H:/Apps/Python/Python38-32/python.exe (found version "3.8.5") found components: Interpreter
15
-- Configuring done
16
-- Generating done
17
-- Build files have been written to: C:/MinGW/googletest/build

beim make bekomme ich dann aber den Fehler
1
$ make
2
[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
3
In file included from C:/MinGW/googletest/googletest/include/gtest/gtest-message.h:55,
4
                 from C:/MinGW/googletest/googletest/include/gtest/gtest-assertion-result.h:46,
5
                 from C:/MinGW/googletest/googletest/include/gtest/gtest.h:59,
6
                 from C:\MinGW\googletest\googletest\src\gtest-all.cc:38:
7
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1244:8: error: 'mutex' in namespace 'std' does not name a type
8
   std::mutex mu_;
9
        ^~~~~
10
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1244:3: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
11
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:758:1:
12
+#include <mutex>
13
 #endif  // GTEST_IS_THREADSAFE
14
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1244:3:
15
   std::mutex mu_;
16
   ^~~
17
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1245:8: error: 'condition_variable' in namespace 'std' does not name a type
18
   std::condition_variable cv_;
19
        ^~~~~~~~~~~~~~~~~~
20
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1245:3: note: 'std::condition_variable' is defined in header '<condition_variable>'; did you forget to '#include <condition_variable>'?
21
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:758:1:
22
+#include <condition_variable>
23
 #endif  // GTEST_IS_THREADSAFE
24
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1245:3:
25
   std::condition_variable cv_;
26
   ^~~
27
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h: In member function 'void testing::internal::Notification::Notify()':
28
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1231:26: error: 'mutex' is not a member of 'std'
29
     std::lock_guard<std::mutex> lock(mu_);
30
                          ^~~~~
31
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1231:26: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
32
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1231:26: error: 'mutex' is not a member of 'std'
33
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1231:26: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
34
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1231:31: error: template argument 1 is invalid
35
     std::lock_guard<std::mutex> lock(mu_);
36
                               ^
37
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1231:38: error: 'mu_' was not declared in this scope
38
     std::lock_guard<std::mutex> lock(mu_);
39
                                      ^~~
40
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1233:5: error: 'cv_' was not declared in this scope
41
     cv_.notify_all();
42
     ^~~
43
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1233:5: note: suggested alternative: 'gcvt'
44
     cv_.notify_all();
45
     ^~~
46
     gcvt
47
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1231:33: warning: unused variable 'lock' [-Wunused-variable]
48
     std::lock_guard<std::mutex> lock(mu_);
49
                                 ^~~~
50
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h: In member function 'void testing::internal::Notification::WaitForNotification()':
51
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1239:27: error: 'mutex' is not a member of 'std'
52
     std::unique_lock<std::mutex> lock(mu_);
53
                           ^~~~~
54
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1239:27: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
55
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1239:27: error: 'mutex' is not a member of 'std'
56
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1239:27: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
57
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1239:32: error: template argument 1 is invalid
58
     std::unique_lock<std::mutex> lock(mu_);
59
                                ^
60
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1239:39: error: 'mu_' was not declared in this scope
61
     std::unique_lock<std::mutex> lock(mu_);
62
                                       ^~~
63
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1240:5: error: 'cv_' was not declared in this scope
64
     cv_.wait(lock, [this]() { return notified_; });
65
     ^~~
66
C:/MinGW/googletest/googletest/include/gtest/internal/gtest-port.h:1240:5: note: suggested alternative: 'gcvt'
67
     cv_.wait(lock, [this]() { return notified_; });
68
     ^~~
69
     gcvt
70
make[2]: *** [googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
71
make[1]: *** [googletest/CMakeFiles/gtest.dir/all] Error 2
72
make: *** [all] Error 2

von Oliver S. (oliverso)


Lesenswert?

Das wird wohl das hier sein:

https://stackoverflow.com/questions/14191566/c-mutex-in-namespace-std-does-not-name-a-type

Wie es nun weitergehen soll, musst du selber rausfinden. Vielleicht 
hilft ein aktueller gcc weiter.

Oliver

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.