我有一个函数,CREATEFILE使用fchmod的隐式声明:C警告:函数 'fchmod'
int createFile(char *pFileName) {
int ret;
if ((ret = open(pFileName, O_RDWR | O_CREAT | O_TRUNC)) < 0)
errorAndQuit(2);
fchmod(ret, S_IRUSR | S_IWUSR);
return ret;
}
在我的文件的顶部,我有以下包括:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
编译时:编译器吐出:
warning: implicit declaration of function ‘fchmod’
我包括所有正确的文件,但得到此警告。程序运行良好,即使有警告。
警告不是错误。 – Falmarri 2011-05-07 01:27:40
@Falmarri不,但他们倾向于告诉你代码可能有问题。倾听他们的想法是个好主意。 – 2011-05-07 01:31:14
@Falmarri是的,我知道。不过,使用-Wall进行编译并不会有任何警告......并且我从来没有说过我正在尝试纠正错误 – itzhero 2011-05-18 16:25:18