c++ error: Function 'get_time' could not be resolved - Ubuntu g++
c++ error: Function 'get_time' could not be resolved - Ubuntu g++
我的 class 上有以下 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)。
开发者自己说here还没有实现,但是现在好像在GCC 5中实现了所以你需要找一个升级。
我的 class 上有以下 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)。
开发者自己说here还没有实现,但是现在好像在GCC 5中实现了所以你需要找一个升级。