dynarray  [SOLVED]

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 370
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

dynarray

Postby raananb » Fri Jul 13, 2018 5:30 pm

An application which has been compiled with no errors since a number of years on MSW and OSX, now raises a problem with the code below.

Under Windows 10, with today's trunk and Visual Studio 2017 WX_DECLARE_OBJARRAY is undelined with green wigglies, reporting that the function declaration is not found but finally getting the application up and running.

Under OSX (10.13.5) GCC 8 raises an error in the second line, pointing at the beginning of the line and claiming a ')'. OSX then raises an error on the fourth line "out-of-line definition of 'Clone' does not match any declaration in wxOnjectArrayTraitsForArrayOfCFTextCtrlPointers'

#include <wx/dynarray.h>
WX_DECLARE_OBJARRAY(wxTextCtrl*, ArrayOfCFTextCtrlPointers);
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(ArrayOfCFTextCtrlPointers);

What is the problem here? (suggestions to use wxVector aside).

User avatar
doublemax
Moderator
Moderator
Posts: 12822
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: dynarray

Postby doublemax » Fri Jul 13, 2018 6:19 pm

What exactly did change since the last time you compiled this? The compiler or the wxWidgets version, or both or anything else?

Code: Select all

WX_DECLARE_OBJARRAY(wxTextCtrl*, ArrayOfCFTextCtrlPointers);
This is a little strange, because WX_DECLARE_OBJARRAY assumes pointers anyway. So most likely it should be:

Code: Select all

WX_DECLARE_OBJARRAY(wxTextCtrl, ArrayOfCFTextCtrlPointers);
But then it shouldn't have worked before.
Use the source, Luke!

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1756
Joined: Sun Jan 03, 2010 5:45 pm

Re: dynarray  [SOLVED]

Postby PB » Fri Jul 13, 2018 7:22 pm

There have been several changes to the obsolete containers code, see
https://github.com/wxWidgets/wxWidgets/search?q=array&unscoped_q=array&type=Commits

I guess these should not break anything in the existing code (assuming the code was correct)...

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 370
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: dynarray

Postby raananb » Fri Jul 13, 2018 9:07 pm

@doublemax
Both changed, apparently - the compiler with 10.13.5 and the code with the trunk.
I'll try with 3.1.1, and then look into wxVector...

@PB
I dont know if the code was correct, but it worked...

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 370
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: dynarray

Postby raananb » Sat Jul 14, 2018 7:47 am

No problems with 3.1.1

The trunk is no longer back-compatible for dynarray with 3.1.1 since June 1.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1756
Joined: Sun Jan 03, 2010 5:45 pm

Re: dynarray

Postby PB » Sat Jul 14, 2018 7:33 pm

raananb wrote:

Code: Select all

#include <wx/dynarray.h>
WX_DECLARE_OBJARRAY(wxTextCtrl*, ArrayOfCFTextCtrlPointers);


What is the problem here?


As doublemax already said, you are not to use a pointer to the class in the declaration of wxObjArray. The documentation states that, e.g. here, but I guess it could be a bit clearer about that...

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 370
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: dynarray

Postby raananb » Thu Jul 19, 2018 8:11 am

The compatibility break bug was reported and a patch was created to restore it (#18169).


Return to “C++ Development”

Who is online

Users browsing this forum: Bing [Bot] and 20 guests