即使在包含 <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;
}
最佳答案
您的程序 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; }
关于c - 即使在包含 <stdlib.h> 之后,'exit' 也会发出警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17674385/