2015-05-05 34 views
0

我有我的類下面的一段C++代碼,在ISO 8601字符串轉換爲time_t結構:C++錯誤:函數「GET_TIME」無法解析 - Ubuntu的G ++

#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 

herestd::get_time應包含iomanip

我想我所要做的只是包括iomanip ......我在這裏錯過了什麼嗎?

我正在運行Ubuntu 14.04 LTS。

感謝您的幫助。

+2

您鏈接的頁面表示這是一個C++ 11功能。你確定你正在使用正確的編譯器嗎? – Diego

+0

是...... C++ 11已打開:'g ++ -std = C++ 0x' – Mendes

回答

2

this bug report的底部Jonathan Wakely報告它可以從GCC 5獲得。您可以使用g++ --version來檢查您的版本。 (應該是std::tm tenpTime FWIW)。

2

開發者自己說here它尚未實現,但現在似乎在GCC 5中實現,因此您需要找到升級。