我有一个过去编译成功的程序,但现在我得到一堆错误。源代码只是:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
int main()
{
int fd;
fd = creat("datafile.dat", S_IREAD | S_IWRITE);
if (fd == -1)
printf("Error in opening datafile.dat\n");
else
{
printf("datafile.dat opened for read/write access\n");
printf("datafile.dat is currently empty\n");
}
close(fd);
exit (0);
}
现在我得到错误:
cre.C:8:54: error: ‘creat’ was not declared in this scope
cre.C:16:17: error: ‘close’ was not declared in this scope
cre.C:17:16: error: ‘exit’ was not declared in this scope
有时我得到一个错误gxx_personality_v0
,有时我根本没有错误!我已经尝试更新gcc
,但问题仍然存在。怎么了?vaio 笔记本电脑上的操作系统 UBUNTU 12.1