编译出错cstring问题
请问, 我用的编译器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;
}
这样编译又没问题
百思不得其解
请问这是什么问题啊?