title: gcc (mac/linux) error no matching function for call while VisualStudio compiles ok
body: <p>I've got a problem with a cross-platform compile.
  The code below compiles on Win, Mac and Linux (program is Qt based) but in order to make it compile on the Mac and Linux I have to defined if/else.</p>
  
  <p>Windows compiler (VS2010) finds the definition but Mac (gcc4.2) and Linux (Ubuntu12LTS) cant find it...</p>
  
  <p>Any ideas? Maybe Im missing some technical terminology in order to search for this?
  I want to be able to use "table->setMark(i,MyObj());" for all systems as it doesnt seem to have any platform specific code.</p>
  
  <pre><code>///// .h
     void setMark(int row, MyObj&amp; mark) 
        { value(row).setMark(mark); }
     const MyObj&amp; getMark(int row) const
        { return value(row).getMark(); }
  /////
  
  
  ///// .cpp
     MyObj obj;
     bool ret = false, ifhandled = false;
     m_root_command.evaluate(obj,ret,ifhandled);
  
     if (m_marked) {
        Table *table = m_thisobj.getTable();
        for (int i = 0; i &lt; table-&gt;getRowCount(); i++) {
  #if defined(_WIN32)
           // this works in windows, but fails to compile
           // on other platforms with error below
           table-&gt;setMark(i,MyObj());
  #else
           // I want to get rid of this workaround
           // and use the above code for all platforms
           MyObj objTmp = MyObj();
           table-&gt;setMark(i,objTmp);
  #endif
        }
        m_marked = false;
     }
  /////
  
  ///// Error
  program.cpp: In member function 'MyObj Program::evaluate()':
  program.cpp:264:36: error: no matching function for call to 'Table::setMark(int&amp;, MyObj)'
  program.cpp:264:36: note: candidate is:
  table.h:326:9: note: void Table::setMark(int, MyObj&amp;)
  table.h:326:9: note:   no known conversion for argument 2 from 'MyObj' to 'MyObj&amp;'
  make: *** [program.o] Error 1
  /////
  </code></pre>