1

下面的代码使用 Sun Studio 在 Solaris 上编译,但在使用 gcc 的 linux 上编译它说 strlen 不是 std 的成员。

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;
}

谢谢

4

1 回答 1

8

您需要包含cstring标题才能获得std::strlen

#include <cstring>
于 2013-09-24T06:49:35.947 回答