记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:8:9: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
    8 |     gets(arr1);
      |     ~~~~^~~~~~
In file included from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/cstdio:42,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/ext/string_conversions.h:43,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/bits/basic_string.h:6608,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/string:55,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/bits/locale_classes.h:40,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/bits/ios_base.h:41,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/ios:42,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/ostream:38,
                 from iostream:39:
/nix/store/rffag931pvbdiabwwa539wnwg1piqpx0-glibc-2.35-163-dev/include/stdio.h:605:14: note: declared here
  605 | extern char *gets (char *__s) __wur __attribute_deprecated__;
      |              ^~~~
foo.cc:9:13: error: 'strlen' was not declared in this scope
    9 |     int x = strlen(arr1);
      |             ^~~~~~
foo.cc:4:1: note: 'strlen' is defined in header '<cstring>'; did you forget to '#include <cstring>'?
    3 | #include<string>
  +++ |+#include <cstring>
    4 | //A8-1
foo.cc:11:9: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
   11 |     gets(arr2);
      |     ~~~~^~~~~~
In file included from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/cstdio:42,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/ext/string_conversions.h:43,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/bits/basic_string.h:6608,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/string:55,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/bits/locale_classes.h:40,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/bits/ios_base.h:41,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/ios:42,
                 from /nix/store/l4dvshb0bw0ipyx17f6rknzk83mdx81y-gcc-11.3.0/include/c++/11.3.0/ostream:38,
                 from iostream:39:
/nix/store/rffag931pvbdiabwwa539wnwg1piqpx0-glibc-2.35-163-dev/include/stdio.h:605:14: note: declared here
  605 | extern char *gets (char *__s) __wur __attribute_deprecated__;
      |              ^~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
A8-1 字符串的输出函数
语言
C++
递交时间
2022-10-09 20:16:12
评测时间
2022-10-09 20:16:12
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes