编译出错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;
}
这样编译又没问题
百思不得其解
请问这是什么问题啊?
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;
}
这样编译又没问题
百思不得其解
请问这是什么问题啊?
...全文
相关推荐
编译出错的VC ACE的MFC程序
我用VC一个程序,编译中遇到很多奇怪的语法错误,麻烦大家给看看。
cstring的相关知识.docx
CString常用类型转换和常用的方法,非常全面。内部的方法基本上自己都使用过。
VC++上位机软件经验总结
编写实时动态显示上位机软件经验与问题总结
C++数组类简介
有关数组类的应用,MFC的数组类支持的数组类似于C++中的常规数组,可以存放任何数据类型。C++的常规数组在使用前必须将其定义成能够容纳所有可能需要的元素,而MFC数组类创建的对象可以根据需要动态地增大或减小,数组的起始下标是0,而上限可以是固定的,也可以随着元素的增加而增加,数组在内存中的地址仍然是连续分配的。
VC+ADO+ORACLE开发.doc
VC+ADO+ORACLE开发,介绍vc++访问数据库的通用方式,给初学者学习vc++数据库编程提供资料。


新手乐园
