当前位置: 技术问答>linux和unix
一个unix环境下C编程问题,请高手指点一下,非常感谢!
来源: 互联网 发布时间:2015-12-08
本文导语: 源代码: #include #include #include #include #include extern int errno; int main() { int fd; if((fd = open("expe.c",O_CREAT|O_EXCL,S_IRWXU))==-1) { pirntf("open errorn error no =%dn",errno); if (errno==EEXIST) printf("open error ,beca...
源代码:
#include
#include
#include
#include
#include
extern int errno;
int main()
{
int fd;
if((fd = open("expe.c",O_CREAT|O_EXCL,S_IRWXU))==-1)
{
pirntf("open errorn error no =%dn",errno);
if (errno==EEXIST)
printf("open error ,because file already exist!n");
}
else printf("success! n");
return 0;
}
在编译的时候提示下面的错误:
/usr/ets/lh-temp> cc open.c
undefined first referenced
symbol in file
pirntf open.o
i386ld fatal: Symbol referencing errors. No output written to a.out
请各位给指点一下,多谢了!
#include
#include
#include
#include
#include
extern int errno;
int main()
{
int fd;
if((fd = open("expe.c",O_CREAT|O_EXCL,S_IRWXU))==-1)
{
pirntf("open errorn error no =%dn",errno);
if (errno==EEXIST)
printf("open error ,because file already exist!n");
}
else printf("success! n");
return 0;
}
在编译的时候提示下面的错误:
/usr/ets/lh-temp> cc open.c
undefined first referenced
symbol in file
pirntf open.o
i386ld fatal: Symbol referencing errors. No output written to a.out
请各位给指点一下,多谢了!
|
大哥,printf!!!
|
pirntf
|
搂主忘记了
|
extern int errno;// 这个好像有点问题