Menu

#704 Contrib plugins compilation error when using wx-master

Undefined
fixed
wx-master (2)
Patch
2021-12-22
2018-06-15
No

Recent changes in wx-master break compilation of wxFlatNotebook and wxchart, see discussion in CB forum

http://forums.codeblocks.org/index.php/topic,22696.0.html

The attached patch fixes this using a typedef to sort the macro expansion problem.

1 Attachments

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2018-06-15

    P.S. This error occurs also for GCC versions older than GCC 8, including 7.1 to 7.3.

     
  • sodev

    sodev - 2018-06-21

    There is no macro expansion problem, the OBJARRAY is just used wrong which the old macros allowed but the new macros not and your patch enables the wrong usage again :o). This is a prime example why macros are dangerous and evil.

    OBJARRAY uses pointers internally but uses them value-wise, it takes care of the lifetime of the objects by deleting them and creating copies of them when necessary. The affected code however uses these arrays pointer-wise, it takes care of the lifetime of these objects itself. In the old wxWidgets versions the code got away with this by creating pointer-of-pointer arrays which the new macros prevent, but since they are macros your typedef trick allows the creation of these pointer-of-pointer arrays again.

    The correct solution is to use the proper array type for "unmanaged" pointers, see the attached patch.

     
  • Miguel Gimenez

    Miguel Gimenez - 2018-06-21

    I have removed my patch and applied yours, but compilation fails:

    ||=== Build: wxFlatNoteBook in wxWidgets - Contrib Items wx3.1.x (compiler: GNU GCC Compiler) ===|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|353|note: in definition of macro '_WX_DEFINE_TYPEARRAY_HELPER'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|693|note: in expansion of macro '_WX_DEFINE_TYPEARRAY'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|861|note: in expansion of macro 'WX_DEFINE_TYPEARRAY_WITH_DECL'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|note: in expansion of macro 'WX_DEFINE_USER_EXPORTED_ARRAY'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|421|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|440|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|353|note: in definition of macro '_WX_DEFINE_TYPEARRAY_HELPER'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|693|note: in expansion of macro '_WX_DEFINE_TYPEARRAY'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|861|note: in expansion of macro 'WX_DEFINE_TYPEARRAY_WITH_DECL'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|note: in expansion of macro 'WX_DEFINE_USER_EXPORTED_ARRAY'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|353|note: in definition of macro '_WX_DEFINE_TYPEARRAY_HELPER'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|693|note: in expansion of macro '_WX_DEFINE_TYPEARRAY'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|421|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|861|note: in expansion of macro 'WX_DEFINE_TYPEARRAY_WITH_DECL'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|note: in expansion of macro 'WX_DEFINE_USER_EXPORTED_ARRAY'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|421|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'bool wxFlatNotebook::AddPage(wxWindow*, const wxString&, bool, int)':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|197|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|197|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'bool wxFlatNotebook::InsertPage(size_t, wxWindow*, const wxString&, bool, int)':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|222|error: 'm_windows' was not declared in this scope|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|55|note: in definition of macro 'FNB_MIN'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|222|note: suggested alternative: 'm_windowId'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|55|note: in definition of macro 'FNB_MIN'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'void wxFlatNotebook::SetSelection(size_t)':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|273|error: 'm_windows' was not declared in this scope|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|440|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|440|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|273|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|277|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|277|note: suggested alternative: 'm_windowId'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|353|note: in definition of macro '_WX_DEFINE_TYPEARRAY_HELPER'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|693|note: in expansion of macro '_WX_DEFINE_TYPEARRAY'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|861|note: in expansion of macro 'WX_DEFINE_TYPEARRAY_WITH_DECL'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|note: in expansion of macro 'WX_DEFINE_USER_EXPORTED_ARRAY'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|421|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|440|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|304|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|304|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|310|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|310|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|315|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|315|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|318|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|318|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'void wxFlatNotebook::DeletePage(size_t, bool)':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|342|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|342|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|362|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|362|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'bool wxFlatNotebook::DeleteAllPages()':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|394|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|394|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|399|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|399|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|404|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|404|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'wxWindow* wxFlatNotebook::GetCurrentPage() const':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|418|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|418|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'wxWindow* wxFlatNotebook::GetPage(size_t) const':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|423|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|423|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|426|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|426|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'int wxFlatNotebook::GetPageIndex(wxWindow*) const':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|431|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|431|note: suggested alternative: 'm_windowId'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|353|note: in definition of macro '_WX_DEFINE_TYPEARRAY_HELPER'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|693|note: in expansion of macro '_WX_DEFINE_TYPEARRAY'|
    G:\Librerias32\wxWidgets-3.1.1\include\wx\dynarray.h|861|note: in expansion of macro 'WX_DEFINE_TYPEARRAY_WITH_DECL'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|58|note: in expansion of macro 'WX_DEFINE_USER_EXPORTED_ARRAY'|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|421|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    wxFlatNotebook\include\wx\wxFlatNotebook\wxFlatNotebook.h|440|error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?|
    wxFlatNotebook\include\wx\wxFlatNotebook\xh_fnb.h|24|warning: type attributes ignored after type is already defined [-Wattributes]|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'bool wxFlatNotebook::RemovePage(size_t, bool)':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|554|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|554|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|573|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|573|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'void wxFlatNotebook::Enable(size_t, bool)':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|684|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|684|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|687|error: 'm_windows' was not declared in this scope|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|687|note: suggested alternative: 'm_windowId'|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp||In member function 'virtual void wxPageContainer::MoveTabPage(int, int)':|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|1733|error: 'class wxFlatNotebook' has no member named 'GetWindows'; did you mean 'wxWindow'?|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|1739|error: 'class wxFlatNotebook' has no member named 'GetWindows'; did you mean 'wxWindow'?|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|1740|error: 'class wxFlatNotebook' has no member named 'GetWindows'; did you mean 'wxWindow'?|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|1742|error: 'class wxFlatNotebook' has no member named 'GetWindows'; did you mean 'wxWindow'?|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|1743|error: 'class wxFlatNotebook' has no member named 'GetWindows'; did you mean 'wxWindow'?|
    G:\Codeblocks\src\plugins\contrib\wxContribItems\wxFlatNotebook\src\wxFlatNotebook\wxFlatNotebook.cpp|1744|error: 'class wxFlatNotebook' has no member named 'GetWindows'; did you mean 'wxWindow'?|
    
     
  • Miguel Gimenez

    Miguel Gimenez - 2018-06-21

    I applied your patch and then compilation fails. I quoted the full list of errors in my previous post, but it's awaiting moderation. The first error was in line 58 of wxFlatNotebook.h:

    error: 'wxWindowPtrArray' does not name a type; did you mean 'wxWindowVariant'?
    
     
    • sodev

      sodev - 2018-06-21

      Do a full rebuild and make sure you got rid of all precompiled headers

       
  • Miguel Gimenez

    Miguel Gimenez - 2018-06-22

    OK, it compiles now

     
  • bluehazzard

    bluehazzard - 2019-05-16
    • assigned_to: bluehazzard
     
  • bluehazzard

    bluehazzard - 2019-05-16

    Does anything speaks against this patch?
    I have to resetup my environment to be able to test this...

     
  • Teodor Petrov

    Teodor Petrov - 2019-05-16

    Apply objarray.patch only if it is needed against what killerbot uses to build night builds or if it is needed with wx-master. I have no opinion on the second dynarray.patch.

     
  • sodev

    sodev - 2019-05-17

    Just to clarify, both patches are mutually exclusive and achieve the same, getting CodeBlocks to compile against newer/with disabled compatibility wxWidgets versions, they are just using a different approach.

    objarray.patch gets the broken code to compile again, dynarray.patch fixes the broken code (couldn't test this though).

     
  • Teodor Petrov

    Teodor Petrov - 2020-04-18

    Is this still broken? C::B seems to build fine with wx-master...

     
  • sodev

    sodev - 2020-04-18

    Yes, it is still broken, but the wxWidgets folks made broken code to compile again, just for the sake of compatibility. See the explanation here https://github.com/wxWidgets/wxWidgets/commit/02ffdd16f6664a3b81e24ced192fbeccaa4393ef. So i'm still sure my patch fixes the code, too bad i still don't know what to do that these code locations are getting executed so that i can verfiy that.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-12-22
    • status: open --> fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.