views:

69

answers:

1

Hi guys, I have some class which uses boost singleton. It calls some function from own c++ library. This library is written in make file as dependence. Now I have another singleton class and it should call first singleton class. After this code I got linkers error about undefined references for functions which are used in first singleton.

When I remove calling first singleton class from second the errors remove. Maybe there is something wrong?

class First : public boost::singleton<First>
{
   void temp() { /* Calling function from own library */ }
};

class Second : public boost:singleton<Second>
{
    const First &someInstance() const { return First::get_const_instance(); }
};

End errors:

In function `First::temp()':
undefined reference to `Ogre::WindowEventUtilities::messagePump()'
undefined reference to `Ogre::Root::renderOneFrame()'

Yes, there is calling Ogre's functions from temp one.

A: 

These errors indicate you're not linking correctly with Ogre.

If they disappear when Second isn't referencing First, that's because First is not being referenced/used anywhere else.

Did you try using First in your code to check whether the errors remain?

jweyrich