I have included following headers:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
I have also tried to use
#define _GNU_SOURCE
before #include <unistd.h>
, but it also does not help.
I try to use fcntl
and pass it F_SETPIPE_SZ
as second argument, but I keep getting this error message:
error: ‘F_SETPIPE_SZ’ undeclared (first use in this function)
I actually found out that I don't need this, but I'm just curious why I can't use it.
Thank you.
So here's solution, thanks to Chrono Kitsune: Put
#define _GNU_SOURCE
before any includes.
fcntl
. Can you post that in your question? – Occidentalize#define _GNU_SOURCE
before including any headers. I doubt that will help, but it is worth saying. What doesuname -r
show? If it is less than 2.6.35, you shouldn't haveF_SETPIPE_SZ
. The man page I have documents it as being available since Linux 2.6.35. – Romany_GNU_SOURCE
is a Linux glibc feature test macro (man feature_test_macros
), just like_POSIX_C_SOURCE
and_XOPEN_SOURCE
, it is perfectly reasonable to simply define the macro on a per-file basis before including any headers. The man page specifically states that it is allowed. The important point is to define it before any headers are included, meaning either on the command line or in a file. – Romany