【发布时间】:2010-06-05 14:41:33
【问题描述】:
我有一些使用 boost 单例的类。它从自己的 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()'
是的,有一个从temp调用Ogre的函数。
【问题讨论】:
-
也许有。但除非您发布一些代码和您收到的错误消息,否则我们不太可能识别问题。