开发者

Boost singleton trouble

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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜