编译出错cstring问题

han4235 han4235 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
请问, 我用的编译器gcc 4.4.5-6
error: 'strlen' was not declared in this scope
总是出现这个问题, 我在网上查了下 说是要加#include <cstring>
但是加了之后就出现这个问题
from hash.cpp:2:
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:76: error: '::memchr' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:77: error: '::memcmp' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:78: error: '::memcpy' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:79: error: '::memmove' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:80: error: '::memset' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:81: error: '::strcat' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:82: error: '::strcmp' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:83: error: '::strcoll' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:84: error: '::strcpy' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:85: error: '::strcspn' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:86: error: '::strerror' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:87: error: '::strlen' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:88: error: '::strncat' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:89: error: '::strncmp' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:90: error: '::strncpy' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:91: error: '::strspn' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:92: error: '::strtok' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:93: error: '::strxfrm' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:94: error: '::strchr' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:95: error: '::strpbrk' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:96: error: '::strrchr' has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/cstring:97: error: '::strstr' has not been declared

我是用的automake生成的工程代码, 如果写了一个测试文件
#include <cstring>

int main()
{

char *xx = "dsdf";
strlen(xx);
return 1;
}

这样编译又没问题
百思不得其解
请问这是什么问题啊?
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
han4235
新手乐园 33,315 成员 41,769 内容