我想摆脱警告.当我编译源代码时
gcc -Wall -ansi -o test test.c
Run Code Online (Sandbox Code Playgroud)
我回来了
test.c: In function ‘main’:
test.c:12: warning: implicit declaration of function ‘getresuid’
test.c:14: warning: implicit declaration of function ‘seteuid’
Run Code Online (Sandbox Code Playgroud)
当我编译它没有-ansi开关
gcc -Wall -o test test.c
Run Code Online (Sandbox Code Playgroud)
我在终端上看到了
test.c: In function ‘main’:
test.c:12: warning: implicit declaration of function ‘getresuid’
Run Code Online (Sandbox Code Playgroud)
我想用-ansi开关并摆脱警告.我怎样才能实现目标?
/* this is the test.c */
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#define __USE_GNU 1
#define __USE_BSD 1
int main()
{
static uid_t euid, ruid, suid;
getresuid(&ruid, &euid, &suid);
seteuid(getuid());
return …Run Code Online (Sandbox Code Playgroud)