meta data for this page
  •  

Find out which header to include

If you have problems finding out which header has defined certain variable, use:

find /usr/include/ -type f|xargs grep -s -e "PARAMETER_TO_SEARCH"

OR without pipe

find /usr/include/ -type f -exec grep -s -e "PARAMETER_TO_SEARCH" {} +

Exclude the /usr/include/ from the include line and use the rest as include. E.g. if searching for IPV6_MULTICAST:

find  /usr/include/ -type f|xargs grep -s -e "IPV6_MULTICAST"
/usr/include/i386-linux-gnu/bits/in.h:#define IPV6_MULTICAST_IF	17
/usr/include/i386-linux-gnu/bits/in.h:#define IPV6_MULTICAST_HOPS	18
/usr/include/i386-linux-gnu/bits/in.h:#define IPV6_MULTICAST_LOOP	19
/usr/include/linux/in6.h:#define IPV6_MULTICAST_IF	17
/usr/include/linux/in6.h:#define IPV6_MULTICAST_HOPS	18
/usr/include/linux/in6.h:#define IPV6_MULTICAST_LOOP	19

Use the in6.h in /usr/include/linux:

#include <linux/in6.h>

CT30A5002 - Games and Networking