When I update my wx into latest 3.1.6 version, codeblocks could not be compiled any more, because a c++ issue:
n file included from /usr/include/wx-3.1/wx/wx.h:24,
from /usr/include/wx-3.1/wx/wxprec.h:42,
from ../../../src/include/sdk_common.h:24,
from ../../../src/include/sdk_precomp.h:13:
/usr/include/wx-3.1/wx/event.h: In instantiation of 'constexpr auto wxPrivate::DoCast(void (C::*)(E&)) [with E = wxHtmlLinkEvent; C = CCManager]':
../../../src/sdk/ccmanager.cpp:290:22: required from here
/usr/include/wx-3.1/wx/event.h:157:12: error: 'wxEvtHandler' is an inaccessible base of 'CCManager'
157 | return static_cast<void (wxEvtHandler::*)(E&)>(pmf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But, the CCManager DO is the child class of wxEvtHandler. How to fix this compile issue?
/usr/include/wx-3.1/wx/event.h:157:12: note: in pointer to member function conversion
@kipade, wxWidgets devs are asking for a quick check, can you do it?. I don't have GCC11.
https://trac.wxwidgets.org/ticket/19266 (https://trac.wxwidgets.org/ticket/19266)
This is the code to compile:
// This is a compilation-time-only test: just check that a class inheriting
// from wxEvtHandler non-publicly can use Bind() with its method, this used to
// result in compilation errors.
// Note that this test will work only on C++11 compilers, so we test this only
// for such compilers.
#if __cplusplus >= 201103
class HandlerNonPublic : protected wxEvtHandler
{
public:
HandlerNonPublic()
{
Bind(wxEVT_IDLE, &HandlerNonPublic::OnIdle, this);
}
void OnIdle(wxIdleEvent&) { }
};
#endif // C++11
EDIT: You can use the attached minimal wxWidgets project, it includes the code above. It is a MSW project, but can be easily adapted to Linux.
There is another question in the ticket about the output of this code:
#include <iostream>
int main()
{
std::cout << "__cplusplus= " << __cplusplus << std::endl;
return (int)__cplusplus;
}