strlen 未在此范围内声明 - C++
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4564850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
strlen was not declared in this scope - C++
提问by Vivek
I need to install a simulator in my ubuntu. It is written in C++ and when I try to run make, I get this error strlen was not declared in this scope
. Any solution to overcome this error?
我需要在我的 ubuntu 中安装一个模拟器。它是用 C++ 编写的,当我尝试运行 make 时,出现此错误strlen was not declared in this scope
。有什么解决方案可以克服这个错误?
回答by icecrime
This should do it :
这应该这样做:
#include <cstring>
回答by dan04
#include <cstring>
Your program may also be looking for ::strlen
instead of std::strlen
. If this is the case, try
您的程序也可能正在寻找::strlen
而不是std::strlen
. 如果是这种情况,请尝试
using std::strlen;
回答by Spike
did you install all packages you needed?
你安装了你需要的所有软件包吗?
- try g++ --version and see if it gives something.
- check /usr/lib/include/ for string.h.
- 试试 g++ --version 看看它是否给出了一些东西。
- 检查 /usr/lib/include/ 中的 string.h。
If those things are not there, you need to check if the correct package is installed or not.
如果这些东西不存在,您需要检查是否安装了正确的软件包。