Developer Blog -
  • Skipper - The ORM Designer
  • VsBuilds - Parallel building
  • Pulpo - Free Skipper CLI

Tag: #g++

Strange "no matching function for call to ..." error on MacOS

Error appear when using BOOST::fusion::map<....>

Error message:

In file included from axOrm/ormObject/ormObject.test.cpp:5:<br />
axOrm/ormObject/testObjects/objContactAndAddress.h: In member function 'void Atomix::Orm::Tests::CBaseOrmContact::SetName(XString)':<br />
axOrm/ormObject/testObjects/objContactAndAddress.h:92: error: no matching function for call to 'Atomix::Orm::Tests::CBaseOrmContact::GetPropertyHolder()'<br />

Invalid source code

template &lt;class TNameParam&gt; typename fus::result_of::at_key&lt; TmapAssociations,TNameParam&gt;::type &amp; GetAssociationHolder()<br />
{ return fus::at_key&lt;TNameParam&gt;(m_mapAssociations); }<br />

for fix simply change result_of::at_key to result_of::value_at_key

template &lt;class TNameParam&gt; typename fus::result_of::value_at_key&lt;TmapAssociations,TNameParam&gt;::type &amp; GetAssociationHolder()<br />

After fixing this error, you can achieved problem with const modifier. Correct syntax for const definition is:

template <typename TNameParam> typename fus::result_of::value_at_key<const TmapProperties,TNameParam>::type const & GetPropertyHolder() const
{ return fus::at_key<TNameParam>(m_mapProperties); }

28 Jun 2011

Posted by: ludek.vodicka

Programming Mac OS #MacOs #C++ #g++

g++ error: conversion from XTestObjectA to non-scalar type XTestObjectBase requested

//error<br />
XTestObjectBase objTestObjectBase1 = objTestObjectA;</p>
<p>//ok<br />
XTestObjectBase objTestObjectBase2(objTestObjectA);</p>
<p>//ok<br />
XTestObjectBase objTestObjectBase3; objTestObjectBase3 = objTestObjectA;<br />

cite from:

The problem is that the number of user-defined conversions that are invoked implicitly is limited (to 1) by the Standard.

B ob = a;
implies two user conversions:

on a: Wrap::operator A*() should be called
on the result: B::B(A*) should be called

The solution is to use explicit conversion

//now ok<br />
XTestObjectBase objTestObjectBase1 = XTestObjectBase(objTestObjectA);<br />
07 Jun 2011

Posted by: ludek.vodicka

Programming Linux #Linux #C++ #g++

g++ error: expected primary-expression before > token

For g++ compiler is sometimes necessary to specify more typename / template keywords than for Visual Studio. This is one of examples.

To the following code it's necessary to add template keyword:

TMemoryManager &amp; memMngr = GetMemoryManager();<br />
m_pObject =<br />
  memMngr.CreateObject&lt;TObject&gt;(this, m_pContainerOwner);<br />


TMemoryManager &amp; memMngr = GetMemoryManager();<br />
m_pObject =<br />
  memMngr.template CreateObject&lt;TObject&gt;(this, m_pContainerOwner);<br />

07 Jun 2011

Posted by: ludek.vodicka

Programming Linux #Linux #C++ #g++ #templates