anonymous
anonymous

Reputation: 1968

error strlen not a member of std only on linux not on solaris

below code compiles on Solaris using Sun Studio but on linux using gcc it says strlen is not a member of 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;
}

Thanks

Upvotes: 3

Views: 7791

Answers (1)

juanchopanza
juanchopanza

Reputation: 227608

You need to include the cstring header to get std::strlen:

#include <cstring>

Upvotes: 13

Related Questions