error: 'const wxEventTable wxWindow::sm_eventTable' is protected

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

error: 'const wxEventTable wxWindow::sm_eventTable' is protected

Post by rocrail »

I'm trying to build Git Tag v3.1.5 under Windows 10-64.

I do not know how to solve the following compiler error:

Code: Select all

g++ -c -o gcc_mswu\monolib_datectlg.o -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\zlib -I..\..\src\regex -I..\..\src\expat\expat\lib  -O2 -mthreads -D__WXMSW__   -DNDEBUG    -D_UNICODE -I..\..\lib\gcc_lib\mswu -I..\..\include  -W -Wall -DWXBUILDING -I..\..\src\stc\scintilla\include -I..\..\src\stc\scintilla\lexlib -I..\..\src\stc\scintilla\src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX -DLINK_LEXERS -DwxUSE_BASE=1   -Wno-ctor-dtor-privacy  -std=gnu++11 -MTgcc_mswu\monolib_datectlg.o -MFgcc_mswu\monolib_datectlg.o.d -MD -MP ../../src/generic/datectlg.cpp
In file included from ..\..\include/wx/window.h:18:0,
                 from ..\..\include/wx/nonownedwnd.h:14,
                 from ..\..\include/wx/toplevel.h:20,
                 from ..\..\include/wx/dialog.h:14,
                 from ../../src/generic/datectlg.cpp:25:
..\..\include/wx/event.h:4328:42: error: 'const wxEventTable wxWindow::sm_eventTable' is protected
         static const wxEventTable        sm_eventTable;                 \
                                          ^
..\..\include/wx/msw/window.h:804:5: note: in expansion of macro 'wxDECLARE_EVENT_TABLE'
     wxDECLARE_EVENT_TABLE();
     ^
..\..\include/wx/event.h:4333:23: error: within this context
         { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
                       ^
../../src/generic/datectlg.cpp:330:1: note: in expansion of macro 'wxBEGIN_EVENT_TABLE'
 wxBEGIN_EVENT_TABLE(wxDatePickerCtrlGeneric, wxDatePickerCtrlBase)
 ^
makefile.gcc:11804: recipe for target 'gcc_mswu\monolib_datectlg.o' failed
mingw32-make: *** [gcc_mswu\monolib_datectlg.o] Error 1

The build command is as followed:

Code: Select all

cd build\msw
mingw32-make -f makefile.gcc BUILD=release UNICODE=1 MONOLITHIC=1 SHARED=0 USE_GUI=1 CXXFLAGS="-std=gnu++11" clean
mingw32-make -f makefile.gcc BUILD=release UNICODE=1 MONOLITHIC=1 SHARED=0 USE_GUI=1 CXXFLAGS="-std=gnu++11"
Best regards,
Rob.
https://wiki.rocrail.net
User avatar
rocrail
Super wx Problem Solver
Super wx Problem Solver
Posts: 293
Joined: Fri Oct 02, 2009 2:02 pm
Contact:

Re: error: 'const wxEventTable wxWindow::sm_eventTable' is protected

Post by rocrail »

As test I did a v3.1.5 ZIP build instead of GITHUB.
Same result as first posted.

The src/generic/datectlg.cpp seems to have a problem.

I kindly ask for some help/hints.
Best regards,
Rob.
https://wiki.rocrail.net
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: error: 'const wxEventTable wxWindow::sm_eventTable' is protected

Post by PB »

I have just downloaded wxWidgets-3.1.5.zip from http://wxwidgets.org/downloads/ and successfully built it using your exact command line with two GCCs: (1) 64-bit v8.1 from mingw-64 installer "x86_64-8.1.0-win32-seh-rt_v6-rev0" and (2) 32-bit v10.3 from MSYS2 package "mingw-w64-i686-gcc".

Therefore I find it likely the issue is not with wxWidgets but your process.

Firstly, I would not rely on make's clean but I would make sure the build is clean by deleting WXDIR/build/msw/gcc_mswu and WXDIR/lib/gcc_lib folders. If this does not help, I would delete the whole WXDIR folder and extracted the archive anew, to make sure the sources are not modified.

Secondly, you did not provide information about GCC version and distribution you are using. I do not find it likely, but it still may be possible you are using an incompatible (i.e., buggy) GCC package.

BTW,

Code: Select all

UNICODE=1 SHARED=0 USE_GUI=1
are defaults, so no need to use them when building.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: error: 'const wxEventTable wxWindow::sm_eventTable' is protected

Post by stahta01 »

My wild guess is a buggy compiler installation.

1. The compiler used is bad
2. Other compilers on the computer is causing the problem
3. sh.exe is in the path and is causing the problem

Tim S.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: error: 'const wxEventTable wxWindow::sm_eventTable' is protected

Post by ONEEYEMAN »

Hi Rob,
Is there a reason you are (still) using monolithic build?

Thank you.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: error: 'const wxEventTable wxWindow::sm_eventTable' is protected

Post by stahta01 »

If you are using the new GCC 11.

From https://www.gnu.org/software/gcc/gcc-11/changes.html
The 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.
Post Reply