title: Problems Compiling simple C program against custom Linux Kernel
body: <p>I recently compiled a custom kernel which defines a new address family/protocol family called "AF_CUSTOM"</p>
  
  <p>Such, include/linux/socket.h in the my kernel source was changed, as seen here(as well as for PF_CUSTOM):</p>
  
  <pre><code>#define AF_NFC      39  /* NFC sockets          */
  #define AF_CUSTOM       40  /* Custom sockets           */
  #define AF_MAX      41  /* For now.. */
  </code></pre>
  
  <p>I plan to implement AF_CUSTOM, but as quick sanity check, I decided to modify a typical sample c socket program and see if replacing "socket(AF_INET, SOCK_STREAM, 0)" with "socket(AF_CUSTOM, SOCK_STREAM, 0)" would compile, but it did not.
  I got the following error when compiling with gcc: <code>'AF_CUSTOM' undeclared</code>
  I assumed that it would at least compile, because AF_CUSTOM should be defined in the current kernel.</p>
  
  <p>The problem, as I see it, is that gcc is using the default kernel headers to resolve "#include &lt;sys/socket.h&gt;" and not the headers that correspond to the custom kernel that is currently running. I tried using both -I and -isystem options on gcc to direct it to the path that Ubuntu seems to place the kernel headers for the other kernels, as they seemed relevant from my Google research, but they didn't help.</p>
  
  <p><strong>My question is: How can I compile a C program against the headers for the currently running custom kernel as opposed to the default kernel headers.</strong></p>
  
  <p>I tried this:
  <code>gcc -isystem /usr/src/linux-headers-3.8.8-custom.5/ sendOnCustom.c -o sendOnCustom</code></p>
  
  <p>FYI, compiled using make-kpkg. Also, this is my first question, I hope it is understandable.</p>