News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

wx2.9.5 Patch for wxWidgets - Contrib Items wx2.9.x

Started by stahta01, August 17, 2013, 11:11:04 PM

Previous topic - Next topic

stahta01

I have found an compile bug/design changed issue caused by wxWidgets 2.9.5

Example Compiler Error

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.


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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Jenna

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.

MortenMacFly

...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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]