Does using the POSIX header file #include <net/if.h>
require a library to be linked aswell? I get the below error when I use a constant from the header file.
error:
IFNAMSIZ
undeclared
#include <net/if.h>
int main(int argc, char** argv) {
char f[IFNAMSIZ]; // compiler error
return 0;
}
If I need a library, whats the name of it? Something like gcc -o test test.c -lif --std=c11
is not a valid library. Googling this is turning up nothing which is quite frustrating.
*PS: how do you find out what libraries a POSIX header requires?
Solution: The problem is because I am compiling with --std=c11
. This question describes the problem and the solution: Why does C99 complain about storage sizes?