即使在包含<stdlib.h> </stdlib.h>之后,'exit'也会发出警告

时间:2013-07-16 10:40:04

标签: c linux header-files

即使在加入<stdlib.h>

后,我也会收到警告

warning: incompatible implicit declaration of built-in function ‘exit’

有人知道它为什么给予?

void Check_file(char *filepath)
{
        if(access( filepath, F_OK ) == -1 ) {
                printf("\nUnable to access : %s\n",filepath);

                exit(1);
        }
        return;
}

1 个答案:

答案 0 :(得分:1)

提供正确的包含文件时,您的程序compiles without complaint

#include <stdio.h>              /* needed for printf */
#include <stdlib.h>             /* needed for exit */
#include <unistd.h>             /* needed for access and F_OK */
void Check_file(char *filepath)
{
        if(access( filepath, F_OK ) == -1 ) {
                printf("\nUnable to access : %s\n",filepath);

                exit(1);
        }
        return;
}
int main () { return 0; }