如何修复 C++ 错误:'put_time' is not a member of 'std'
问题:
尝试编译 C++ 应用程序时,你看到类似这样的错误消息
error_put_time.txt
src/HTTPServer.cpp:12:16: error: 'put_time' is not a member of 'std'
ss << std::put_time(std::localtime(&localTime), "%FT%H-%M-%SZ");;
^~~~~~~~解决方案
在出现此错误的文件顶部,你需要添加
include_iomanip.cpp
#include <iomanip>iomanip 包含 std::put_time() 及其他功能。
Check out similar posts by category:
C/C++, GCC Errors
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow