Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
cutecode
Super wx Problem Solver
Posts: 427 Joined: Fri Dec 09, 2016 7:28 am
Contact:
Post
by cutecode » Tue Aug 03, 2021 7:31 am
Why do I get "non dll-interface" warning on MS VS only
I don't have this warning on Linux,MAC and windows code::blocks
Code: Select all
wxInterpriter.h(178): warning C4275: non dll-interface class 'wxPtrArrayOfVarObjs' used as base for dll-interface class 'wxPtrArray_' (sendfile.cpp)
wxInterpriter.h(174) : see declaration of 'wxPtrArrayOfVarObjs'
wxInterpriter.h(177) : see declaration of 'wxPtrArray_'
Here are my declarations
Code: Select all
#if defined(__WXMSW__)
#ifndef __WXDLLMAIN__
#define __WXDLLMAIN__LIB__ __declspec(dllimport)
#else
#define __WXDLLMAIN__LIB__ __declspec(dllexport)
#endif
#else
#ifndef __WXDLLMAIN__
#define __WXDLLMAIN__LIB__
#else
#define __WXDLLMAIN__LIB__
#endif
#endif
Code: Select all
class __WXDLLMAIN__LIB__ wxVarObjs
{
Code: Select all
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxVarObjs*, wxPtrArrayOfVarObjs, class __WXDLLMAIN__LIB__);
Code: Select all
class __WXDLLMAIN__LIB__ wxPtrArray_ : public wxPtrArrayOfVarObjs
{
public:
PB
Part Of The Furniture
Posts: 4204 Joined: Sun Jan 03, 2010 5:45 pm
Post
by PB » Tue Aug 03, 2021 10:09 am
Firstly, why are you still using these long-deprecated classes? The documentation clearly states they are not to be used in the new code.
Secondly, why are you using the macro differently than in the documentation: Should the macro not take the care about the class export declaration without you doing it?
stahta01
Ultimate wxWidgets Guru
Posts: 550 Joined: Fri Nov 03, 2006 2:00 pm
Post
by stahta01 » Wed Aug 04, 2021 6:55 am
cutecode
Super wx Problem Solver
Posts: 427 Joined: Fri Dec 09, 2016 7:28 am
Contact:
Post
by cutecode » Wed Aug 04, 2021 7:42 am
Hello
changing from WX_DEFINE_USER_EXPORTED_ARRAY_PTR to WX_DEFINE_ARRAY or WX_DEFINE_USER_EXPORTED_ARRAY
gives the same warning on MSVS
stahta01
Ultimate wxWidgets Guru
Posts: 550 Joined: Fri Nov 03, 2006 2:00 pm
Post
by stahta01 » Thu Aug 05, 2021 1:17 am
Do you have any reason to believe you can sub class the result?
I am not an C++ expert; I am just a C++ beginner or early intermediate level; but, that seems like a idea that is not valid.
Tim S.
cutecode
Super wx Problem Solver
Posts: 427 Joined: Fri Dec 09, 2016 7:28 am
Contact:
Post
by cutecode » Thu Aug 05, 2021 11:26 am
stahta01 wrote: ↑ Thu Aug 05, 2021 1:17 am
Do you have any reason to believe ...
Code: Select all
on MS VS only
I don't have this warning on Linux,MAC and windows code::blocks
PB
Part Of The Furniture
Posts: 4204 Joined: Sun Jan 03, 2010 5:45 pm
Post
by PB » Thu Aug 05, 2021 2:31 pm
I think the warning is pretty clear, you need to decide whether it is valid in this case, as described in the bullets in
its description .
I also do not find surprising that you do not get this warning with GCC, many compiler warnings are compiler- or even compiler-version-specific.
BTW, I am also no C++ (or anything else) expert.
cutecode
Super wx Problem Solver
Posts: 427 Joined: Fri Dec 09, 2016 7:28 am
Contact:
Post
by cutecode » Sun Aug 08, 2021 12:24 pm
I got this warning after moving to wx-3.1.6
I got my backup from old wx-3.1.1 and rebuiled the project.
And I don't have this warning in wx-3.1.1
Both versions are working stable anyway.
But this warning is annoying in wx-3.1.6 ))))
Thank you!
PB
Part Of The Furniture
Posts: 4204 Joined: Sun Jan 03, 2010 5:45 pm
Post
by PB » Sun Aug 08, 2021 1:46 pm
cutecode wrote: ↑ Sun Aug 08, 2021 12:24 pm
I got this warning after moving to wx-3.1.6
I got my backup from old wx-3.1.1 and rebuiled the project.
And I don't have this warning in wx-3.1.1
This is probably due to this change:
https://github.com/wxWidgets/wxWidgets/ ... 7891e731b3
cutecode wrote: ↑ Sun Aug 08, 2021 12:24 pm
But this warning is annoying in wx-3.1.6 ))))
If all it is is just being annoying, just suppress the warning, wxWidgets does it when its containers derive from the std ones.