Author Topic: wx2.9.5 Patch for wxWidgets - Contrib Items wx2.9.x  (Read 6022 times)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
wx2.9.5 Patch for wxWidgets - Contrib Items wx2.9.x
« on: August 17, 2013, 11:11:04 pm »
I have found an compile bug/design changed issue caused by wxWidgets 2.9.5

Example Compiler Error
Code
src\plugins\contrib\wxContribItems\wxchart\src\legendwindow.cpp|34|error: no 'wxObject* wxLegendWindow::wxCreateObject()' member function declared in class 'wxLegendWindow'|

Reason seems to be the use of wxWidgets Macro DECLARE_CLASS when the correct Macro is DECLARE_DYNAMIC_CLASS in the header file.
It is needed if IMPLEMENT_DYNAMIC_CLASS is used in the source file.

Can an C++ and wxWidgets expect confirm this is correct?

Patch below; it compiles with wxWidgets 2.9.5; but, no other testing has been done.

Code
Index: src/plugins/contrib/wxContribItems/wxchart/include/wx/yaxiswindow.h
===================================================================
--- src/plugins/contrib/wxContribItems/wxchart/include/wx/yaxiswindow.h (revision 9266)
+++ src/plugins/contrib/wxContribItems/wxchart/include/wx/yaxiswindow.h (working copy)
@@ -86,7 +86,7 @@
     void OnPaint(wxPaintEvent &event);
     void OnMouse(wxMouseEvent &event);
 
-    DECLARE_CLASS(wxYAxisWindow)
+    DECLARE_DYNAMIC_CLASS(wxYAxisWindow)
     DECLARE_EVENT_TABLE()
 };
 
Index: src/plugins/contrib/wxContribItems/wxchart/include/wx/legendwindow.h
===================================================================
--- src/plugins/contrib/wxContribItems/wxchart/include/wx/legendwindow.h (revision 9266)
+++ src/plugins/contrib/wxContribItems/wxchart/include/wx/legendwindow.h (working copy)
@@ -67,7 +67,7 @@
     void OnMouse(wxMouseEvent &event);
     void OnMouseMove(wxMouseEvent &event);
 
-    DECLARE_CLASS(wxLegendWindow)
+    DECLARE_DYNAMIC_CLASS(wxLegendWindow);
     DECLARE_EVENT_TABLE()
 };
 

Tim S.

 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wx2.9.5 Patch for wxWidgets - Contrib Items wx2.9.x
« Reply #1 on: August 17, 2013, 11:53:51 pm »
I just stumbled across the same issue.
I just committed the fix.

In wx2.8 DECLARE_CLASS and DECLARE_DYNAMIC_CLASS are the same, while in wx2.9 they differ.
The dynamic classes implement a static wxCreateObject function, which is not declared by DECLARE_CLASS.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: wx2.9.5 Patch for wxWidgets - Contrib Items wx2.9.x
« Reply #2 on: August 18, 2013, 07:14:41 am »
...I already have a patch pending for this - it just needs testing....
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ