c - Does POSIX if.h require a library to use -
does using posix header file #include <net/if.h>
require library linked aswell? below error when use constant header file.
error:
ifnamsiz
undeclared
#include <net/if.h> int main(int argc, char** argv) { char f[ifnamsiz]; // compiler error return 0; }
if need library, whats name of it? gcc -o test test.c -lif --std=c11
not valid library. googling turning nothing quite frustrating.
*ps: how find out libraries posix header requires?
solution: problem because compiling --std=c11
. question describes problem , solution: why c99 complain storage sizes?
from quick google, seems name defined if_namesize
, not ifnamsiz
.
the error getting not missing library*, missing definition @ compiler step, means header file not define ifnamsiz
.
*) if library issue, you'd see linker errors 'missing external symbol' messages.
Comments
Post a Comment