Compiling using -std=cxx
where xx is 99 or 11 depending on what version of C you are using will use different header files than compiling with -std=gnuxx
(where again xx = 99 or 11).
The default setting (if you don't specify a command line argument) for GCC 5.2 is for -std=gnu11
.
The gnu settings define the macros:
_GNU_SOURCE
, which turns on GNU only features;
_POSIX_SOURCE
, which turns on POSIX features;
- and maybe others? (
_BSD_SOURCE
is a possibility but I'm not sure).
If you compile with -std=cxx
then you get standard C and not any extensions.
So this warning is because that function is not part of the C standard. Thus you get an implicit declaration of the function (which was allowed by the old C standards and kept for backwards compatibility).
You can edit your file to have #define _POSIX_SOURCE
if you want to compile with -std=cxx
.