Compiler Warnings During wxWidgets 3.1.0 Compilation

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Compiler Warnings During wxWidgets 3.1.0 Compilation

Post by ColleenKobe »

I am compiling wxWidgets using tdm-gcc. I have not edited any files. I am getting piles of compiler warnings. Did I do something wrong? How do I make these warnings go away?

Compilation warnings examples taken at random:

Code: Select all

...
                                                                    ^
             ^
In file included from ..\..\include/wx/html/forcelnk.h:42:0,
                 from ../../src/html/htmlwin.cpp:1871:
..\..\include/wx/link.h:28:51: warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: us
e SetInitialSize() instead. [-Wdeprecated-declarations]
                 } _wx_link_dummy_var_##module_name;
                                                   ^
..\..\include/wx/html/forcelnk.h:45:20: note: in expansion of macro 'wxFORCE_LINK_MODULE'
 #define FORCE_LINK wxFORCE_LINK_MODULE
                    ^
..\..\include/wx/html/forcelnk.h:59:5: note: in expansion of macro 'FORCE_LINK'
     FORCE_LINK(m_style)
     ^
../../src/html/htmlwin.cpp:1872:1: note: in expansion of macro 'FORCE_WXHTML_MODULES'
 FORCE_WXHTML_MODULES()
 ^
In file included from ..\..\include/wx/nonownedwnd.h:14:0,
                 from ..\..\include/wx/toplevel.h:20,
                 from ..\..\include/wx/frame.h:18,
                 from ../../src/html/htmlwin.cpp:22:
..\..\include/wx/window.h:1917:13: note: declared here
 inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
             ^
In file included from ..\..\include/wx/html/forcelnk.h:42:0,
                 from ../../src/html/htmlwin.cpp:1871:
..\..\include/wx/link.h:28:51: warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: us
e SetInitialSize() instead. [-Wdeprecated-declarations]
                 } _wx_link_dummy_var_##module_name;
                                                   ^
..\..\include/wx/html/forcelnk.h:45:20: note: in expansion of macro 'wxFORCE_LINK_MODULE'
 #define FORCE_LINK wxFORCE_LINK_MODULE
                    ^
..\..\include/wx/html/forcelnk.h:59:5: note: in expansion of macro 'FORCE_LINK'
     FORCE_LINK(m_style)
     ^
../../src/html/htmlwin.cpp:1872:1: note: in expansion of macro 'FORCE_WXHTML_MODULES'
 FORCE_WXHTML_MODULES()
 ^
In file included from ..\..\include/wx/nonownedwnd.h:14:0,
                 from ..\..\include/wx/toplevel.h:20,
                 from ..\..\include/wx/frame.h:18,
                 from ../../src/html/htmlwin.cpp:22:
..\..\include/wx/window.h:1917:13: note: declared here
 inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
             ^
g++ -c -o gcc_mswuddll\monodll_htmprint.o -g -O0 -mthreads  -DHAVE_W32API_H -D__WXMSW__       -D_UNICODE -I..\..\lib\gcc
_dll\mswud -I..\..\include  -W -Wall -DWXBUILDING -I..\..\src\tiff\libtiff -I..\..\src\jpeg -I..\..\src\png -I..\..\src\
zlib -I..\..\src\regex -I..\..\src\expat\lib -I..\..\src\stc\scintilla\include -I..\..\src\stc\scintilla\lexlib -I..\..\
src\stc\scintilla\src -D__WX__ -DSCI_LEXER -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL   -Wno-ctor-dtor-privacy  -fno-kee
p-inline-dllexport -std=c++11 -MTgcc_mswuddll\monodll_htmprint.o -MFgcc_mswuddll\monodll_htmprint.o.d -MD -MP ../../src/
html/htmprint.cpp
In file included from ..\..\include/wx/html/forcelnk.h:42:0,
                 from ../../src/html/htmprint.cpp:847:
..\..\include/wx/link.h:28:51: warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: us
e SetInitialSize() instead. [-Wdeprecated-declarations]
                 } _wx_link_dummy_var_##module_name;
                                                   ^
..\..\include/wx/html/forcelnk.h:45:20: note: in expansion of macro 'wxFORCE_LINK_MODULE'
 #define FORCE_LINK wxFORCE_LINK_MODULE
                    ^
..\..\include/wx/html/forcelnk.h:59:5: note: in expansion of macro 'FORCE_LINK'
     FORCE_LINK(m_style)
     ^
../../src/html/htmprint.cpp:848:1: note: in expansion of macro 'FORCE_WXHTML_MODULES'
 FORCE_WXHTML_MODULES()
 ^
...

Again, the questions are, why am I getting all these warnings, and how do I make them go away?

Environment and Settings

The following directories appear in my path in this sequence (there are other directories in the path, not shown).

Code: Select all

C:\TDM-GCC-32\bin\;C:\TDM-GCC-64\bin\;C:\MinGW;C:\MinGW\bin;C:\wxWidgets\;C:\wxWidgets\bin\;C:\wxWidgets\include\;C:\wxWidgetslib\gcc_dll\;
I have the following environment variables set:

Code: Select all

WXCFG=gcc_lib/mswud
WXWIN=C:\wxWidgets
Software Versions:

CodeLite 9.1.5
tdm-gcc 5.1.0.3
Windows 7 6.1
wxWidgets 3.1.0
Last edited by ColleenKobe on Thu Apr 14, 2016 1:12 pm, edited 1 time in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Compiler Warnings During wxWidgets 3.0.2 Compilation

Post by ONEEYEMAN »

Hi, Colleen,
You title says it 3.0.2 but the software list at the end says 3.1.0.

Please correct it. ;-)

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Compiler Warnings During wxWidgets 3.0.2 Compilation

Post by doublemax »

Please post the exact command line you used to build wxWidgets.

Also, when it comes to GCC + wxWidgets, the latest compiler version is not always the best. TDM-GCC 4.8.1 is known to work.
Use the source, Luke!
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Compiler Warnings During wxWidgets 3.0.2 Compilation

Post by evstevemd »

doublemax wrote:Please post the exact command line you used to build wxWidgets.

Also, when it comes to GCC + wxWidgets, the latest compiler version is not always the best. TDM-GCC 4.8.1 is known to work.
Those errors come with GCC 5.x.x. It seems it seems some checks that were not enabled by default are now enabled or something like that.
They are harmless and I always ignore them
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Compiler Warnings During wxWidgets 3.0.2 Compilation

Post by evstevemd »

Here is interesting ticket (especially the reporter) :D
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65974
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
iwbnwif
Super wx Problem Solver
Super wx Problem Solver
Posts: 282
Joined: Tue Mar 19, 2013 8:52 pm

Re: Compiler Warnings During wxWidgets 3.0.2 Compilation

Post by iwbnwif »

You can find these 2 lines in path_to_wxwidgets/include/wx/window.h (be careful to make sure it is the right one, there are a couple of similar lines):

Code: Select all

    wxDEPRECATED_MSG("use SetInitialSize() instead.")
    virtual void SetInitialBestSize(const wxSize& size);
And comment out the wxDEPRECATED_MSG line like this:

Code: Select all

    // wxDEPRECATED_MSG("use SetInitialSize() instead.")
    virtual void SetInitialBestSize(const wxSize& size);
There is a thread about this on wx-user (which I think sparked the ticket evstevemd mentioned). Search for "A lot of warnings with gcc 5.1 RC1".
wxWidgets 3.1.2, MinGW64 8.1.0, g++ 8.1.0, Ubuntu 19.04, Windows 10, CodeLite + wxCrafter
Some people, when confronted with a GUI problem, think "I know, I'll use Eclipse RCP". Now they have two problems.
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Re: Compiler Warnings During wxWidgets 3.0.2 Compilation

Post by ColleenKobe »

ONEEYEMAN wrote:Hi, Colleen,
You title says it 3.0.2 but the software list at the end says 3.1.0.

Please correct it. ;-)

Thank you.
Hi, OneEyeMan.

Done! I apologize for the conflict. I started with wxWidgets version 3.0.2. Then I uninstalled wxWidgets and installed 3.1.0,
hoping the warnings would go away. They did not. But I did forget to update my title.

Thanks!
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Re: Compiler Warnings During wxWidgets 3.0.2 Compilation

Post by ColleenKobe »

doublemax wrote:Please post the exact command line you used to build wxWidgets.

Also, when it comes to GCC + wxWidgets, the latest compiler version is not always the best. TDM-GCC 4.8.1 is known to work.
Hi, doublemax. Thanks for the tip on TDM-GCC 4.8.1.

Here is the batch file I used to build the 32-bit Debug and Release versions of wxWidgets.

Code: Select all

cls
rem   wxWidgets has been installed into C:\wxWidgets.
rem   32-bit TDM-GCC was installed into C:\TDM-GCC-32.
rem   64-bit TDM-GCC was installed into C:\TDM-GCC-64.
rem   gcc was installed into C:\MinGW.
rem
rem   The path contains, among other directories, this sequence:
rem
rem   C:\TDM-GCC-32\bin\;C:\TDM-GCC-64\bin\;C:\MinGW;C:\MinGW\bin;C:\wxWidgets\;C:\wxWidgets\bin\;C:\wxWidgets\include\;C:\wxWidgets\lib\gcc_dll\;
rem

C:
cd %WXWIN%\build\msw

rem
rem             M a k e   t h e   3 2 - b i t   R e l e a s e   B u i l d
rem
mingw32-make -f makefile.gcc setup_h
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 MONOLITHIC=1 BUILD=release setup_h

mingw32-make -f Makefile.gcc SHARED=1 UNICODE=1 BUILD=release VENDOR=cl CXXFLAGS="-fno-keep-inline-dllexport -std=c++11" MONOLITHIC=1 clean
mingw32-make -f Makefile.gcc SHARED=1 UNICODE=1 BUILD=release VENDOR=cl CXXFLAGS="-fno-keep-inline-dllexport -std=c++11" MONOLITHIC=1

rem
rem               M a k e   t h e   3 2 - b i t   D e b u g   B u i l d
rem
mingw32-make -f makefile.gcc setup_h
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 MONOLITHIC=1 BUILD=debug setup_h

mingw32-make -f Makefile.gcc SHARED=1 UNICODE=1 BUILD=debug VENDOR=cl CXXFLAGS="-fno-keep-inline-dllexport -std=c++11" MONOLITHIC=1 clean
mingw32-make -f Makefile.gcc SHARED=1 UNICODE=1 BUILD=debug VENDOR=cl CXXFLAGS="-fno-keep-inline-dllexport -std=c++11" MONOLITHIC=1
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Compiler Warnings During wxWidgets 3.1.0 Compilation

Post by ONEEYEMAN »

Hi, Colleen,
Not related to the warnings you see, but....

Is there a reason you build the library as 'monolithic'? This type of build is not tested very often and usually is not preferable.

Removing it might not fix the warning you see but it may help you in the long run.

The 'Unicode' flag is obsolete. wxWidgets used to have 2 types of build - ANSI and UNICODE. However, starting with 3.0, there is no more ANSI build that is officially supported. All official builds of wx are now UNICODE-only.

In regards to gcc version - I don't know what is your intention, but full C++11 support is implemented in gcc-5.2. I don't know anything about MinGW though In this aspect. I'm using MSVC on Windows.

Just wanted you to be aware of those 3 points.

Thank you.
User avatar
ColleenKobe
Earned some good credits
Earned some good credits
Posts: 109
Joined: Mon Aug 31, 2015 3:47 pm

Re: Compiler Warnings During wxWidgets 3.1.0 Compilation

Post by ColleenKobe »

ONEEYEMAN wrote:Hi, Colleen,
[snip]
Is there a reason you build the library as 'monolithic'? This type of build is not tested very often and usually is not preferable.

The 'Unicode' flag is obsolete. [snip]... All official builds of wx are now UNICODE-only.

In regards to gcc version - I don't know what is your intention, but full C++11 support is implemented in gcc-5.2. I don't know anything about MinGW though In this aspect. I'm using MSVC on Windows.
[snip]Thank you.
Hi, ONEEYEMAN,

Thanks for letting me know of the three points.

* Regarding the monolithic library setting. I specified that because that was what the example I was following did. There are many things a beginner does because he or she doesn't know any better, and this is apparently one of them. What are the ramifications of specifying "MONOLITHIC=0"? How will that affect anything I do later on?

* Regarding the Unicode flag. Same beginner issue as above. I'll take the "UNICODE=1" compiler option out right now.

* Regarding the gcc version. I'm using TDM-GCC because I was told to, because TDM-GCC plays nicer with wxWidgets and Windows. So I can't really switch over to gcc. But thanks for letting me know about the gcc version. I see they released gcc 6.1 just two days ago. Now I'm two versions behind, instead of one. :-P

Colleen
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Compiler Warnings During wxWidgets 3.1.0 Compilation

Post by ONEEYEMAN »

Hi, Colleen,
There is no issue that the end user of the library will encounter. Like I said the monolithic build is very rarely tested. The issue will be that instead of one big library you will have couple smaller one and it will significantly simplify the life of you as a end point developer.
Without the monolithic you might get a smaller executable (notice a word _might_) and it will be easier to work with the library in general.
Keep in mind that the "UNICODE" flag is just obsolete. You should still be able to compile the library with "UNICODE=0", but it is impractical and will not be supported in the future.
In terms of gcc, you can simplify the life for yourself - go to wxWidgets website "Download" section and see if there is a set of libraries already for you version of gcc. If there is - grab them and install them and then just use them. They are an official release pre-compiled libraries for you. This should get you started as you are not making any configuration changes (i.e. default configuration is OK for you).
Just keep in mind that if you will find an issue during the development, we will ask you to reproduce the problem in the sample at which point you will need to compile and run the sample against you pre-compiled libraries you download. This process was and is the official way of reporting the problem either here, on IRC channel or on wx-dev/wx-users mailing lists.

Thank you.
Post Reply