I'm trying to compile ncurses 5.9 for an embedded system (using buildroot) and I get this error message:
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 ());
Here's the code in question:
/* 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.
};
Line 256 is this one: return reinterpret_cast<T*>(get_user ());
The problem here was due to a compiler update to g++ (Debian 7.2.0-5)
. New compilers have better error handling, and this old code was written without its benefit. The solution here is to either use a more recent version of ncurses (no-go for my particular situation) or use an older compiler. Since my host system is Debian, I used update-alternatives to switch to g++ 6.4 and the problematic error message went away.
I'm leaving this here because Google gave me no good results for the error message.