关于linux下splice的使用
本帖最后由 javametro 于 2014-03-20 20:18 编辑自己在学习socket编程,写的demo,然后编译的时候出现如下提示:# gcc -o reply reply.c
reply.c: In function ‘main’:
reply.c:46: error: ‘SPLICE_F_MORE’ undeclared (first use in this function)
reply.c:46: error: (Each undeclared identifier is reported only once
reply.c:46: error: for each function it appears in.)
reply.c:46: error: ‘SPLICE_F_MOVE’ undeclared (first use in this function)使用的是splice的系统调用,按理说这个宏定义应该是在头文件中定义了的啊,怎么会这样呢?
还请大家指教 。
gcc不会自动帮你找定义,要自己包含相应的头文件 回复 2# timespace
头文件是包含进来了的。 NAME
splice - splice data to/from a pipe
SYNOPSIS
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <fcntl.h>
ssize_t splice(int fd_in, loff_t *off_in, int fd_out,
loff_t *off_out, size_t len, unsigned int flags);
回复 2# timespace
有定义宏_GNU_SOURCE吗?
页:
[1]