title: Undefined reference to `shm_open' even while compiling with -pthread -lrt
body: <p>I see a similar question has been asked with no coherent solution. 
  Using the gcc compiler on linux, I get the message: </p>
  
  <pre><code>/tmp/ccPNsJFZ.o: In function `main':
  testChTh.c:(.text+0xbfb): undefined reference to `shm_open'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>after typing  <code>gcc -pthread -lrt -o testChTh testChTh.c</code> into the command line. I only use shm_open once in my code, which is: </p>
  
  <pre><code>int shm_fd;
  
    /* create the shared memory segment */
    shm_fd = shm_open(name, O_RDWR, 0666);
  </code></pre>
  
  <p>I have the following relevant libraries included:</p>
  
  <pre><code>#include &lt;fcntl.h&gt;
  #include &lt;sys/shm.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;sys/mman.h&gt;
  #include &lt;unistd.h&gt;
  </code></pre>
  
  <p>Any insight is much appreciated!</p>