title: Ubuntu Message Queue Makefile Error
body: <p>I have a problem with message queues in C in Ubuntu. I use VirtualBox to run the Ubuntu.</p>
  
  <p>I took error which is "undefined reference to mq_open. ld returned 1 exit status".</p>
  
  <p>I know there is a same question as this but I tried that solution but it did not worked, so I want to ask again. Please help!</p>
  
  <p>Here is my code, it is really simple but I can not even compile it.</p>
  
  <p>this is my deneme.c </p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;mqueue.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;string.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;sys/wait.h&gt;
  #include &lt;sys/stat.h&gt;
  
  #include "sharedMsg.h"
  
  int main()
  {
    mqd_t mq;
    mq = mq_open(MQNAME, O_RDWR | O_CREAT, 0666, NULL);
  }
  </code></pre>
  
  <p>this is my sharedMsg.h</p>
  
  <pre><code>struct item{
    char *word;
    int lineNum;
  };
  
  #define MQNAME "/sentmsg"
  </code></pre>
  
  <p>and finally this is my MakeFile</p>
  
  <pre><code>all: deneme
  deneme: deneme.c
      gcc -g -Wall -o deneme deneme.c -lrt
  clean:
      rm -fr *~ *.o 
  </code></pre>