2010-06-05 93 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來檢查錯誤是否仍然存在?