gpt4 book ai didi

C++ 错误 : Function 'get_time' could not be resolved - Ubuntu g++

转载 作者:行者123 更新时间:2023-11-27 22:58:36 27 4
gpt4 key购买 nike

我的类中有以下 C++ 代码,用于将 ISO 8601 字符串转换为 time_t 结构:

#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <ctime>


.... class code...


struct tm tempTime;
std::stringstream ss(data);
ss >> std::get_time(&tempTime, "%FT%TZ");
std::time_t time = mktime(&tempTime);

.... class code...

但编译器坚持给我以下错误:

Function 'get_time' could not be resolved

根据 here , std::get_time 应该包含在 iomanip

我想我所要做的就是包括 iomanip...我在这里遗漏了什么吗?

我运行的是 Ubuntu 14.04 LTS。

感谢您的帮助。

最佳答案

this bug report的底部Jonathan Wakely 报告说它可以从 GCC 5 获得。您可以使用 g++ --version 来检查您的版本。 (应为 std::tm tenpTime FWIW)。

关于C++ 错误 : Function 'get_time' could not be resolved - Ubuntu g++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30043293/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com