C/C++ – _M_underflow_common

by

When you define you own character traits (e.g., ignorecase_traits – to ignore the case when comparing strings) you might run into the following link error:

In function `std::basic_filebuf<char, ignorecase_traits>::uflow()'::
undefined reference to `std::basic_filebuf<char, ignorecase_traits>::
_M_underflow_common(bool)'

The solution is to add the following to one of your CC/CPP files:

struct cGet_M_underflow_common : std::basic_filebuf<char> {
  int_type mGet_M_underflow_common(bool b) {
    return _M_underflow_common(b);
  };
};

icfielbuf::int_type icfielbuf::_M_underflow_common(bool bump) {
  return reinterpret_cast<cGet_M_underflow_common *>(this)->
    mGet_M_underflow_common(bump);
};
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: