如何在编译C++代码时解决一些版本控制问题
how do I fix some versioning issue when compiling C++ code?
我正试图在Linux上编译位于http://sourceforge.net/projects/desr/files/Release/desr-0.9.tgz/download。
当我跑步的时候/配置,一切顺利,直到我键入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.
当存在时
#include <cstring>
g++编译器应该将它自己包含的声明放入std::AND全局名称空间中。出于某种原因,它似乎没有这么做。尝试用std::strcpy替换strcpy的一个实例。
我也遇到过类似的问题。在我的情况下,头文件包含的顺序如下
#include <string> // for string class
#include <cstring> // for memcpy()
因此,我遇到了您在gcc 4.6.3中提到的上述错误。
切换包含已工作的顺序。。
此问题的一个可能原因是您设法在命名空间块中获得了#include <cstring>
。
这将导致为include保护设置#define
,阻止您在其他任何地方重新导入它,但同时将所有符号加载到您的命名空间中,而不是加载到它们所属的全局范围中。
当我试图将内联模板定义与它们的声明放在一个单独的文件中时,有时会犯这个错误。
尽管这个问题已经很老了,但我只会添加到@Daniels的答案中。对我来说,这个错误是因为在源文件中,在一个类定义未以;
终止的头之后包含了<cstring>
。
相关文章:
- 在一个解决方案中针对第三方静态库 (Creo) 的不同版本(版本)进行构建
- C++11 谷物序列化 - 版本控制
- 解决与构建"Debug x64"版本的暗网相关的错误
- Msgpack中是否具有版本控制功能
- 从模板化类版本控制序列化派生类
- 哪些 Netbeans 8.2 项目文件应提交到C++项目的版本控制?
- CUDA9.2及以上版本中模板默认参数存在无法解决的外部函数错误
- 如何创建受版本控制的 DLL
- 如何解决LDCONFIG创建带有版本号的链接
- 控制达到非空功能结束.我该如何解决这个问题
- visualstudio2008解决方案发布版本运行时致命错误
- 如何在性能和VMS上对C++进行代码审查/调试/编码/测试/版本控制
- GCC 函数多版本控制和命名空间
- 如何在编译C++代码时解决一些版本控制问题
- C++STL版本控制问题+Boost
- 避免DLL版本控制问题
- VC++VS2013项目从非版本控制文件夹移动到版本控制文件夹后未进行编译
- 这些辅助文件是否应在 Git 版本控制下
- C++命名空间版本控制
- 向静态库中添加一个全局变量以进行版本控制