是这样的:
一份代码,在本地编译零警告零错误通过了
然后在我谷编译有错误qwq
错误代码如下,哪位大佬能帮我康康qwq
编译信息
编译失败
/tmp/tmplfuxdzwd/src:3:11: 错误:‘int kill’被重新声明为不同意义的符号
int eat=0,kill=0;
^~~~
In file included from /usr/include/c++/8/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/8/bits/stdc++.h:43,
from /tmp/tmplfuxdzwd/src:1:
/usr/include/signal.h:112:12: 附注:previous declaration ‘int kill(__pid_t, int)’
extern int kill (__pid_t __pid, int __sig) __THROW;
^~~~
/tmp/tmplfuxdzwd/src: 在函数‘void done()’中:
/tmp/tmplfuxdzwd/src:19:19: 警告:ISO C++ 不允许对类型为‘int (*)(__pid_t, int) throw ()’ {aka ‘int (*)(int, int)’}的指针自减 [-Wpointer-arith]
if(kill>0){kill--;return;}
^~
/tmp/tmplfuxdzwd/src:19:19: 错误:自减操作数必须是左值
/tmp/tmplfuxdzwd/src:38:19: 警告:ISO C++ 不允许对类型为‘int (*)(__pid_t, int) throw ()’ {aka ‘int (*)(int, int)’}的指针自减 [-Wpointer-arith]
if(kill>0){kill--;return;}
^~
/tmp/tmplfuxdzwd/src:38:19: 错误:自减操作数必须是左值
/tmp/tmplfuxdzwd/src:45:28: 错误:向函数‘int kill(__pid_t, int)’赋值
int k=read();done();kill=k;return;
^