关于找不到struct flock的定义

betterzy 2006-04-06 04:08:12
在学习GNU/LINUX编程指南,第11章,使用fcntl函数,
#include <unistd.h>
#include <fcntl.h>

int fcntl(int fd, int cmd);
int fcntl(int fd, int cmd, long arg);
int fcntl(int fd, int cmd, struct flock *lock);

最后一个的函数的第三个参数,struct flock找不到定义
他的例子程序编译出错
struct flock lock;//说他error: `lcok' undeclared (first use in this function)

头文件都加了啊,还有,碰到这样的问题一般怎么解决?
...全文
353 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
nevil 2006-04-07
  • 打赏
  • 举报
回复
你用什么系统?
struct flock在/usr/include/bits/fcntl.h中有定义,该头文件被/usr/include/fcntl引用,所以引用<fcntl>是够了.
betterzy 2006-04-07
  • 打赏
  • 举报
回复
加了,但是还是没有用
nevil 2006-04-06
  • 打赏
  • 举报
回复
加个<sys/types.h>看看

23,124

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧