2017-10-17 80 views
-1

當我試圖編譯的ncurses 5.9嵌入式系統(使用buildroot的),我得到這個錯誤信息:錯誤編譯ncurses的

In file included from ../c++/cursesm.h:39:0, 
       from ../c++/cursesm.cc:35: 
../c++/cursesp.h: In member function ‘T* NCursesUserPanel<T>::UserData() const’: 
../c++/cursesp.h:256:43: error: no matching function for call to 
‘NCursesUserPanel<T>::get_user() const’ 
    return reinterpret_cast<T*>(get_user()); 

這裏是有問題的代碼:

/* We use templates to provide a typesafe mechanism to associate 
* user data with a panel. A NCursesUserPanel<T> is a panel 
* associated with some user data of type T. 
*/ 
template<class T> class NCursesUserPanel : public NCursesPanel 
{ 
public: 
    NCursesUserPanel (int nlines, 
        int ncols, 
        int begin_y = 0, 
        int begin_x = 0, 
        const T* p_UserData = STATIC_CAST(T*)(0)) 
    : NCursesPanel (nlines, ncols, begin_y, begin_x) 
    { 
     if (p) 
     set_user (const_cast<void *>(p_UserData)); 
    }; 
    // This creates an user panel of the requested size with associated 
    // user data pointed to by p_UserData. 

    NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() 
    { 
    if (p) 
     set_user(const_cast<void *>(p_UserData)); 
    }; 
    // This creates an user panel associated with the ::stdscr and user data 
    // pointed to by p_UserData. 

    virtual ~NCursesUserPanel() {}; 

    T* UserData (void) const 
    { 
    return reinterpret_cast<T*>(get_user()); 
    }; 
    // Retrieve the user data associated with the panel. 

    virtual void setUserData (const T* p_UserData) 
    { 
    if (p) 
     set_user (const_cast<void *>(p_UserData)); 
    } 
    // Associate the user panel with the user data pointed to by p_UserData. 
}; 

256行是這一個:return reinterpret_cast<T*>(get_user());

回答

1

這裏的問題是由於編譯器更新爲g++ (Debian 7.2.0-5)。新的編譯器具有更好的錯誤處理能力,而且這個舊代碼的編寫沒有任何好處。這裏的解決方案是使用更新版本的ncurses(對於我的特定情況,不使用)或使用較舊的編譯器。由於我的主機系統是Debian,因此我使用update-alternatives切換到g ++ 6.4,並且有問題的錯誤信息消失了。

我在這裏離開這裏,因爲Google沒有給我提供錯誤信息的好結果。