为什么会出现错误“未在此范围内声明”

时间:2020-05-18 00:00:01

标签: c++ oop strcpy strlen

这是我的代码的一部分,其中出现两个错误:

void Person::setName(char* n) {
    Name = new char[strlen(n) + 1];
    strcpy(Name, n);
}
main.cpp:217:26: error: ‘strlen’ was not declared in this scope
  Name = new char[strlen(n) + 1];
main.cpp:218:16: error: ‘strcpy’ was not declared in this scope
  strcpy(Name, n);

我正在使用在线C ++编译器。

0 个答案:

没有答案