warning: implicit declaration of function ‘getresuid’ (and ‘seteuid’)

后端 未结 2 711
广开言路
广开言路 2020-12-18 08:54

I would like to get rid of the warnings. When I compile the source code with

gcc -Wall -ansi -o test test.c  

I get back

te         


        
相关标签:
2条回答
  • 2020-12-18 09:34

    getresuid() and seteuid() are GNU extension function, add

    #define _GNU_SOURCE
    

    before including all the headers, or add -D_GNU_SOURCE in GCC options.

    You shouldn't define __USE_GNU macro directly, it's supposed to be used only internally in glibc.

    0 讨论(0)
  • 2020-12-18 09:38

    I solved by adding #include <unistd.h>

    0 讨论(0)
提交回复
热议问题