2010-06-05 89 views
0

我有一些使用提升单身人士的课。它从自己的C++库调用一些函数。这个库在make文件中被写为依赖。 现在我有另一个单例类,它应该调用第一个单例类。在这段代码之后,我得到了关于在第一个单例中使用的函数的未定义引用的链接器错误。提升单身麻烦

当我从第二次删除调用第一个单例类错误删除。也许有什么问题?

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(); } 
}; 

结束错误:

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

是的,有从临时一个调用食人魔的功能。

+1

也许有。但除非你发布了一些代码和错误信息,否则我们不太可能发现问题。 – 2010-06-05 14:49:34

+0

@ neil-butterworth做到了。 – Ockonal 2010-06-05 15:03:40

回答

0

这些错误表明你没有正确连接Ogre。

如果它们在Second没有引用First时消失,那是因为First未在其他地方被引用/使用。

您是否尝试在代码中使用First来检查错误是否仍然存在?