admin@DESKTOP-D29TBDD MINGW64 ~/Desktop/windows-paho c-c++/build-c++-gcc $ mingw32-make.exe [ 6%] Building CXX object src/CMakeFiles/paho-cpp-objs.dir/async_client.cpp.obj In file included from C:\Users\admin\Desktop\windows-paho c-c++\paho.mqtt.cpp-master\src\mqtt/async_client.h:30, from C:\Users\admin\Desktop\windows-paho c-c++\paho.mqtt.cpp-master\src\async_client.cpp:20: C:/Users/admin/Desktop/WINDOW~1/PAHOMQ~1.CPP/src/mqtt/token.h:73:37: error: 'mutex' is not a member of 'std' using guard = std::lock_guard<std::mutex>; ^~~~~ C:/Users/admin/Desktop/WINDOW~1/PAHOMQ~1.CPP/src/mqtt/token.h:73:37: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'? C:/Users/admin/Desktop/WINDOW~1/PAHOMQ~1.CPP/src/mqtt/token.h:40:1: +#include <mutex> #include <chrono> C:/Users/admin/Desktop/WINDOW~1/PAHOMQ~1.CPP/src/mqtt/token.h:73:37: using guard = std::lock_guard<std::mutex>; ^~~~~ C:/Users/admin/Desktop/WINDOW~1/PAHOMQ~1.CPP/src/mqtt/token.h:73:37: error: 'mutex' is not a member of 'std' C:/Users/admin/Desktop/WINDOW~1/PAHOMQ~1.CPP/src/mqtt/token.h:73:37: note: 'std::mutex' is defined in header '<mutex>'; did you forget to '#include <mutex>'? C:/Users/admin/Desktop/WINDOW~1/PAHOMQ~1.CPP/src/mqtt/token.h:73:42: error: template argument 1 is invalid
时间: 2023-08-16 19:03:57 浏览: 382
Delphi 12 控件之lmdsetup-d29.zip
这个错误是由于在使用`std::mutex`之前没有包含`<mutex>`头文件导致的。你需要在`token.h`文件中添加`#include <mutex>`来解决这个问题。请尝试在`token.h`文件的开头添加以下代码:
```cpp
#include <mutex>
```
然后重新编译你的代码看看是否能够解决问题。
阅读全文