title: C++: cannot call member function without object
body: <p>I have a class nammed MessageQueue, with 2 methods (one template, and one normal) with a different signature, but with the same name. All the methods are <strong>static</strong>.</p>
  
  <p>In my class MessageQueue (MessageQueue.h):</p>
  
  <pre><code>template &lt;class T&gt; void MessageQueue::sendMessage(const ___handle queue,
                                                const MESSAGE_ACTION &amp;action,
                                                const T *pMessage)
  {
      sendMessage(queue, action, (void*)pMessage, sizeof(pMessage));
  }
  </code></pre>
  
  <p>In MessageQueue.cpp:</p>
  
  <pre><code>void MessageQueue::sendMessage(const ___handle queue, const MESSAGE_ACTION &amp;action,
                             const void *pMessage, const ___uint16 &amp;size)
  {
    // ...
  }
  </code></pre>
  
  <p>I have a compilation error on this line:</p>
  
  <pre><code>sendMessage(queue, action, (void*)pMessage, sizeof(pMessage));
  </code></pre>
  
  <p>The error is:</p>
  
  <blockquote>
    <p>error: cannot call member function 'void MessageQueue::sendMessage(void*, const MESSAGE_ACTION&amp;, const void*, const ___uint16&amp;)' without object</p>
  </blockquote>