2013-09-24 47 views
-1

下面的代碼在使用Sun Studio的Solaris上編譯,但是在使用gcc的linux上它說strlen不是std的成員。錯誤strlen不是std的成員只在linux上不在solaris

inline std::string pathname(char const *p) 
{ 
    std::string pname; 
    std::transform(p, p+std::strlen(p), std::back_inserter(pname), platform::switch_slash); 
    return pname; 
} 

感謝

+0

你'包括',而不是''? –

+0

你的'#include'指令是什麼?你使用的是什麼版本的Solaris,Linux和GCC? – Dai

+0

爲了將代碼從Windows移植到Linux,我碰到了同樣的事情。 juanchopanza是對的。 –

回答

6

您需要包括cstring頭獲得std::strlen

#include <cstring> 
相關問題