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
Are you using the latest SVN trunc code?
If yes, when did you grab the code?
If not try the very latest CF SVN code as it has changes for 3.1.6 from a few weeks ago.
If the latest truck codes does not help , then comi9ler are you using? Version and the URL you used to download it from?
When did you grab the 3.1.6 Github sources to do the build?
I think it should be.
I always keep it fresh from https://github.com/obfuscated/codeblocks_sf.git. and from its latest commit log, its equal as svn 12529.
and my OS is ArchLinux, gcc version 11.1.0
thanks
Works OK with C::B trunk, wxWidgets head and MinGW 8.1 on MSW.
EDIT: may be related to this bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60829) in GCC. Also related to this (http://trac.wxwidgets.org/ticket/17623) wxWidgets ticket, fixed 5 years ago.
From https://www.gnu.org/software/gcc/gcc-11/changes.html (https://www.gnu.org/software/gcc/gcc-11/changes.html)
QuoteThe default mode for C++ is now -std=gnu++17 instead of -std=gnu++14.
You might be having this new issue because of the default change.
I would try using "-std=gnu++14" to see if that fixes the issue.
Tim S.
Yes, this option do really works for it. Thanks
I have just created a ticket (https://trac.wxwidgets.org/ticket/19266) on wxWidgets bug tracker.
@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;
}
The solution for this issue is Use Bind() instead of Connect(), as indicated in this wxWidgets ticket (https://trac.wxwidgets.org/ticket/19266).
Following the ticket, documentation for Connect() has been updated to remark that it can be used only with methods of classes publicly inheriting from wxEvtHandler. CCManager derives privately from wxEvtHandler, so it should be modified to use Bind() or change visibility of wxEvtHandler.
I will try to make a patch this week using the first option.
This is fixed in the trunk now, thanks!