记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:30:27: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     fgets(s1, 10000, stdin);
                           ^
In file included from /in/foo.cc:1:0:
/usr/include/stdio.h:624:14: note:   initializing argument 1 of 'char* fgets(char*, int, FILE*)'
 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
              ^~~~~
/in/foo.cc:31:24: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
     s1[strcspn(s1, "\n")] = '\0'; // 去掉换行符
                        ^
In file included from /in/foo.cc:2:0:
/usr/include/string.h:280:15: note:   initializing argument 1 of 'size_t strcspn(const char*, const char*)'
 extern size_t strcspn (const char *__s, const char *__reject)
               ^~~~~~~
/in/foo.cc:31:25: error: invalid types 'char[size_t {aka long unsigned int}]' for array subscript
     s1[strcspn(s1, "\n")] = '\0'; // 去掉换行符
                         ^
/in/foo.cc:34:27: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     fgets(s2, 10000, stdin);
                           ^
In file included from /in/foo.cc:1:0:
/usr/include/stdio.h:624:14: note:   initializing argument 1 of 'char* fgets(char*, int, FILE*)'
 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
              ^~~~~
/in/foo.cc:35:24: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
     s2[strcspn(s2, "\n")] = '\0'; // 去掉换行符
                        ^
In file included from /in/foo.cc:2:0:
/usr/include/string.h:280:15: note:   initializing argument 1 of 'size_t strcspn(const char*, const char*)'
 extern size_t strcspn (const char *__s, const char *__reject)
               ^~~~~~~
/in/foo.cc:35:25: error: invalid types 'char[size_t {aka long unsigned int}]' for array subscript
     s2[strcspn(s2, "\n")] = '\0'; // 去掉换行符
                         ^
/in/foo.cc:38:26: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     Concat(result, s1, s2);
                          ^
/in/foo.cc:5:6: note:   initializing argument 1 of 'void Concat(char*, const char*, const char*)'
 void Concat(char* result, const char* s1, const char* s2) {
      ^~~~~~
/in/foo.cc:38:26: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
     Concat(result, s1, s2);
                          ^
/in/foo.cc:5:6: note:   initializing argument 2 of 'void Concat(char*, const char*, const char*)'
 void Concat(char* result, const char* s1, const char* s2) {
      ^~~~~~
/in/foo.cc:38:26: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
     Concat(result, s1, s2);
                          ^
/in/foo.cc:5:6: note:   initializing argument 3 of 'void Concat(char*, const char*, const char*)'
 void Concat(char* result, const char* s1, const char* s2) {
      ^~~~~~
/in/foo.cc:41:55: warning: format '%s' expects argument of type 'char*', but argument 2 has type 'int' [-Wformat=]
     printf("连接后的字符串为:\n%s\n", result);
                                                       ^

信息

递交者
类型
自测
语言
C++
递交时间
2024-11-26 08:18:46
评测时间
2024-11-26 08:18:46
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes