我试图在Linux上编译http://sourceforge.net/projects/desr/files/Release/desr-0.9.tgz/download文件。
当我运行./configure时,一切都很顺利,直到我输入make。然后我得到以下错误:
In file included from ./string.h:33,
from HtmlTokenizer.cpp:24:
/usr/include/c++/4.4/cstring:76: error: ‘::memchr’ has not been declared
/usr/include/c++/4.4/cstring:77: error: ‘::memcmp’ has not been declared
/usr/include/c++/4.4/cstring:78: error: ‘::memcpy’ has not been declared
/usr/include/c++/4.4/cstring:79: error: ‘::memmove’ has not been declared
/usr/include/c++/4.4/cstring:80: error: ‘::memset’ has not been declared
/usr/include/c++/4.4/cstring:81: error: ‘::strcat’ has not been declared
/usr/include/c++/4.4/cstring:82: error: ‘::strcmp’ has not been declared
/usr/include/c++/4.4/cstring:83: error: ‘::strcoll’ has not been declared
/usr/include/c++/4.4/cstring:84: error: ‘::strcpy’ has not been declared
/usr/include/c++/4.4/cstring:85: error: ‘::strcspn’ has not been declared
/usr/include/c++/4.4/cstring:86: error: ‘::strerror’ has not been declared
/usr/include/c++/4.4/cstring:87: error: ‘::strlen’ has not been declared
/usr/include/c++/4.4/cstring:88: error: ‘::strncat’ has not been declared
/usr/include/c++/4.4/cstring:89: error: ‘::strncmp’ has not been declared
/usr/include/c++/4.4/cstring:90: error: ‘::strncpy’ has not been declared
/usr/include/c++/4.4/cstring:91: error: ‘::strspn’ has not been declared
/usr/include/c++/4.4/cstring:92: error: ‘::strtok’ has not been declared
/usr/include/c++/4.4/cstring:93: error: ‘::strxfrm’ has not been declared
/usr/include/c++/4.4/cstring:94: error: ‘::strchr’ has not been declared
/usr/include/c++/4.4/cstring:95: error: ‘::strpbrk’ has not been declared
/usr/include/c++/4.4/cstring:96: error: ‘::strrchr’ has not been declared
/usr/include/c++/4.4/cstring:97: error: ‘::strstr’ has not been declared
有什么问题吗?
下面是g++版本:
g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4条答案
按热度按时间fxnxkyjh1#
当有
g++编译器应该把它自己包含的声明放到std::和全局命名空间。出于某种原因,它似乎没有这样做。尝试将strcpy的一个示例替换为std::strcpy。
jchrr9hc2#
我遇到了类似的问题。在我的例子中,头文件包含的顺序如下
有了这个,我遇到了上面提到的gcc 4.6.3的错误。
正在切换包含工作的顺序..
ymdaylpp3#
这个问题的一个可能原因是您设法在某个命名空间块中获取了一个
#include <cstring>
。这导致为include guard设置
#define
,阻止您将其重新导入到其他任何地方,但同时将所有符号加载到您的名称空间中,而不是加载到它们所属的全局范围中。当我试图将内联模板定义与它们的声明放在一个单独的文件中时,我有时会犯这个错误。
zpgglvta4#
尽管这个问题已经很老了,我还是会加上@Daniels的答案。对我来说,这个错误是因为在源文件中包含
<cstring>
后的一个头文件中的类定义没有以;
终止。