title: Can't build application with boost semaphores
body: <p>So I'm trying to implement a blocking queue using boost, but this thing is impossible to compile...</p>
  
  <pre><code>template&lt;class T&gt;
  class BlockingQueue {
  private:
      std::queue&lt;T&gt; blockedQueue;
      boost::interprocess::interprocess_semaphore *counter;
  
  public:
      BlockingQueue(){
          counter = new boost::interprocess::interprocess_semaphore(0);
      }
      virtual ~BlockingQueue(){
          delete counter;
      }
  
      /**
       * puts blockingly an element to the queue
       */
      void put(T element) {
          this-&gt;blockedQueue.push(element);
          this-&gt;counter-&gt;post();
      }
  
      /**
       * blocingly reads an element fromt he queue
       */
      T* get(){
          this-&gt;counter-&gt;wait();
          T* result = &amp;this-&gt;blockedQueue.front();
          this-&gt;blockedQueue.pop();
          return result;
      }
  
  };
  </code></pre>
  
  <p>then for the testing purposes I only added in my main function</p>
  
  <pre><code>BlockingQueue&lt;int&gt;i;
      i.get();
  </code></pre>
  
  <p>still, when I try to compile it, I get the follwing error:</p>
  
  <blockquote>
    <p>./src/Test.o: In function
    <code>boost::interprocess::ipcdetail::semaphore_init(sem_t*, unsigned
    int)':
    /usr/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp:129:
    undefined reference to</code>sem_init' ./src/Test.o: In function
    <code>boost::interprocess::ipcdetail::semaphore_destroy(sem_t*)':
    /usr/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp:140:
    undefined reference to</code>sem_destroy' ./src/Test.o: In function
    <code>boost::interprocess::ipcdetail::semaphore_wait(sem_t*)':
    /usr/include/boost/interprocess/sync/posix/semaphore_wrapper.hpp:156:
    undefined reference to</code>sem_wait'</p>
  </blockquote>
  
  <p>for compiling I used "g++ -c -fmessage-length=0 -std=c++11 -pthread -lrt"
  so... what did I do wrong?</p>