title: How(exactly) do I change the GCC directory search path?
body: <p>OK so here is the code I am trying to compile:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;time.h&gt;
  #include &lt;netdb.h&gt;
  #include &lt;sys/socket.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;netinet/in.h&gt;
  #include &lt;net/sctp.h&gt;
  
  
  #define MAX_BUFFER 1024
  
  void die(char *s)
  {
        perror(s);
        exit(1);
  }
  
  
  int main(int argc, char **argv)
  {
  
    int    connector,flags,r;
    u_int  port;
    struct hostent*        host;
    struct in_addr         in;
    struct sockaddr_in     rmaddr;
    struct sctp_initmsg    initmsg;
    struct sctp_sndrcvinfo sinfo;
    struct sctp_event_subscribe events; 
    bool   connected = false;   
    char   buffer[MAX_BUFFER];
    char*  exit = "quit";
  
    if(argc!=2) {
          printf("Usage: %s ipaddress\n", argv[0]);
      return -1;
    }
  
  
  
    if((connector = socket(AF_INET,SOCK_STREAM, IPPROTO_SCTP))&lt;0){
        perror("socket");
        return -1;
     }
  
  
  
    printf("Enter the port number you wish to connect(on): ");
    scanf("%u", &amp;port);
    printf("\n");
  
    if(port==0){
                printf("ERR0R: Port number must be between 1 &amp; 65,535\n");
                printf("\n");
                printf("Enter the port number you wish to connect(on): ");
                scanf("%u", &amp;port);
                printf("\n");        
    }
  
  
    memset( &amp;initmsg, 0, sizeof(initmsg) );
    initmsg.sinit_num_ostreams = 3;
    initmsg.sinit_max_instreams = 3;
    initmsg.sinit_max_attempts = 2;
    if(setsockopt(connector,IPPROTO_SCTP,SCTP_INITMSG,&amp;initmsg,sizeof(initmsg))&lt;0){
         perror("setsockopt");
         return -1;
    }
  
    bzero( (void *)&amp;rmaddr, sizeof(rmaddr) );
    rmaddr.sin_family = AF_INET;
    inet_pton(AF_INET, argv[1], &amp;rmaddr.sin_addr);
    rmaddr.sin_port = htons(port);
  
  
  
    connect(connector,(struct sockaddr*)&amp;rmaddr,sizeof(rmaddr));
  
         connected=true;
         memset( (void *)&amp;events, 0, sizeof(events) );
         events.sctp_data_io_event = 1;
         setsockopt(connector, SOL_SCTP, SCTP_EVENTS,(const void *)&amp;events, sizeof(events));
         printf("\n");
         printf("Connected to host: %s",argv[1],"on port %u",port);
         printf("     type 'quit' to disconnect\n");
         printf("\n");
  
  
  
    while(connected==true){
  
         int nbs;
         int nbr = 0;
         int flags = MSG_NOSIGNAL;
         printf("&gt;");
         scanf("%s",buffer);
         printf("\n");
  
         sinfo.sinfo_flags = flags;
  
         nbs = send(connector,(void*)&amp;buffer,sizeof(buffer),flags);        
  
  
  
         printf("\n");
         printf("# bytes sent %i\n", nbs);
         printf("\n");
  
         if(nbs&lt;0){
          perror("sendmsg");
              close(connector);
              return -1;
         }
  
         while(nbr &lt; nbs){
           socklen_t len = sizeof(rmaddr);
           nbr = recv(connector,(void*)&amp;buffer,sizeof(buffer),flags);
  
  
           if(nbr&lt;0){
                 perror("recvmsg");
                 close(connector);
                 return -1;
           }else{
             printf("&gt;&gt;");
                 printf("%s\n",buffer);
                 printf("\n");
           }
  
         }
  
    }
  </code></pre>
  
  <p>}</p>
  
  <p>And when I enter the command "gcc sctp_ec.c" I get the following output:</p>
  
  <pre><code>-*- mode: compilation; default-directory: "/usr/lib/gcc/x86_64-linux-gnu/4.8.4/include/" -*-
  Compilation started at Sun Aug 27 12:43:50
  
  gcc sctp_ec.c
  In file included from sctp_ec.c:10:0:
  /usr/include/net/sctp.h:55:22: fatal error: net/ipv6.h: No such file or directory
  compilation terminated.
  
  Compilation exited abnormally with code 1 at Sun Aug 27 12:43:50
  </code></pre>
  
  <p>So I know what the problem is. The GCC compiler is searching in the wrong directory! I want it to search for files in the path: /usr/lib/gcc/x86_64-linux-gnu/4.8.4/include instead of /usr/include. I tried using the -I, -Idir, and -isystem commands but to no avail. With the -isystem it searches in both of those paths and there are definition conflicts. So what do I do here to permanently change the GCC/emacs24 program to search <strong>only</strong> in the first path where the .c code file is?</p>
  
  <p>FTR I am running emacs24 and GCC on Linux Mint 18.1.</p>