错误 strlen 不是 std 的成员,仅在 Linux 上而不是在 Solaris 上
error strlen not a member of std only on linux not on solaris
下面的代码使用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;
}
谢谢
您需要包含cstring
标头才能获得std::strlen
:
#include <cstring>
相关文章:
- 在C++/Linux中设置单调时钟的一些技巧
- Linux的Cpp上的计时器
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 在Linux中哪里可以找到互斥、未来等的源代码
- 如何在linux终端中同时编译和运行c++代码
- 在Linux for Windows上编译C++代码时出错
- 如何找到锁定Linux futex的C++行
- 在linux上调试巨大的C++项目
- 如何处理linux终端中带有负号(-)的C++中的命令行参数
- c++方法参数只能在linux的发布模式下自行更改
- Linux equivalent of Solaris walkcontext
- 使用Solaris 64位或Linux 32位到Linux 64位的内存映射文件
- 将旧的C++代码从Solaris移植到Linux
- 正则表达式适用于 Linux,但不适用于 Solaris
- mbstowcs 在 Red Hat Linux 上返回 -1,但在 Solaris 上不返回
- C++ 输入流:Solaris 与 Linux 中的操作顺序
- 错误 strlen 不是 std 的成员,仅在 Linux 上而不是在 Solaris 上
- Linux和Solaris Unix: Coredump在函数的末尾
- Linux/Solaris 扩展路径 C++
- 生成调用流图的工具[c++ solaris linux]