Error: ‘wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)’ is deprecated
I got an error at compilation time because of the following deprecated function using wxWidgets-3.0.4:
error: ‘wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)’ is deprecated: use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants [-Werror=deprecated-declarations]
The accurate compilation error:
[35/42] /usr/bin/x86_64-pc-linux-gnu-g++ -DBOOKMARKS_EDITOR -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CHRONO_DYN_LINK -DBOOST_CHRONO_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_LOG_DYN_LINK -DBOOST_LOG_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/include -I/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src -I/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8_build -I/usr/include/jsoncpp -I/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/rtng-bookmark-editor -isystem /usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -isystem /usr/include/wx-3.2-gtk3 -O2 -pipe -march=native -Wall -Wextra -Werror -Wpedantic -pthread -std=gnu++14 -fdiagnostics-color=auto -MD -MT src/radiotray-ng/gui/editor/CMakeFiles/rtng-bookmark-editor.dir/station_drop_target.cpp.o -MF src/radiotray-ng/gui/editor/CMakeFiles/rtng-bookmark-editor.dir/station_drop_target.cpp.o.d -o src/radiotray-ng/gui/editor/CMakeFiles/rtng-bookmark-editor.dir/station_drop_target.cpp.o -c /var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/station_drop_target.cpp
FAILED: src/radiotray-ng/gui/editor/CMakeFiles/rtng-bookmark-editor.dir/station_drop_target.cpp.o
/usr/bin/x86_64-pc-linux-gnu-g++ -DBOOKMARKS_EDITOR -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CHRONO_DYN_LINK -DBOOST_CHRONO_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_LOG_DYN_LINK -DBOOST_LOG_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/include -I/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src -I/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8_build -I/usr/include/jsoncpp -I/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/rtng-bookmark-editor -isystem /usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -isystem /usr/include/wx-3.2-gtk3 -O2 -pipe -march=native -Wall -Wextra -Werror -Wpedantic -pthread -std=gnu++14 -fdiagnostics-color=auto -MD -MT src/radiotray-ng/gui/editor/CMakeFiles/rtng-bookmark-editor.dir/station_drop_target.cpp.o -MF src/radiotray-ng/gui/editor/CMakeFiles/rtng-bookmark-editor.dir/station_drop_target.cpp.o.d -o src/radiotray-ng/gui/editor/CMakeFiles/rtng-bookmark-editor.dir/station_drop_target.cpp.o -c /var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/station_drop_target.cpp
/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/station_drop_target.cpp: In member function ‘wxBitmap StationDragAndDrop::makeDragImage(const std::string&, const wxColour*, const wxColour*)’:
/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/station_drop_target.cpp:112:73: error: ‘wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)’ is deprecated: use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants [-Werror=deprecated-declarations]
112 | tmp_dc.SetFont(wxFont(DRAG_FONT_POINT, wxSWISS, wxITALIC, wxBOLD));
| ^
In file included from /usr/include/wx-3.2-gtk3/wx/font.h:631,
from /usr/include/wx-3.2-gtk3/wx/window.h:23,
from /usr/include/wx-3.2-gtk3/wx/wx.h:38,
from /var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/editor_app.hpp:21,
from /var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/station_drop_target.cpp:29:
/usr/include/wx-3.2-gtk3/wx/gtk/font.h:89:5: note: declared here
89 | wxFont(int size,
| ^~~~~~
/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/station_drop_target.cpp:124:47: error: ‘wxPen::wxPen(const wxColour&, int, int)’ is deprecated: use wxPENSTYLE_XXX constants [-Werror=deprecated-declarations]
124 | dc.SetPen(wxPen(*textcolor, 1, wxSOLID));
| ^
In file included from /usr/include/wx-3.2-gtk3/wx/pen.h:107,
from /usr/include/wx-3.2-gtk3/wx/generic/statusbr.h:18,
from /usr/include/wx-3.2-gtk3/wx/statusbr.h:244,
from /usr/include/wx-3.2-gtk3/wx/frame.h:19,
from /usr/include/wx-3.2-gtk3/wx/wx.h:42:
/usr/include/wx-3.2-gtk3/wx/gtk/pen.h:51:5: note: declared here
51 | wxPen(const wxColour& col, int width, int style);
| ^~~~~
/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/station_drop_target.cpp:125:49: error: ‘wxBrush::wxBrush(const wxColour&, int)’ is deprecated: use wxBRUSHSTYLE_XXX constants [-Werror=deprecated-declarations]
125 | dc.SetBrush(wxBrush(*background, wxSOLID));
| ^
In file included from /usr/include/wx-3.2-gtk3/wx/brush.h:77,
from /usr/include/wx-3.2-gtk3/wx/dc.h:24,
from /usr/include/wx-3.2-gtk3/wx/wx.h:51:
/usr/include/wx-3.2-gtk3/wx/gtk/brush.h:41:5: note: declared here
41 | wxBrush(const wxColour& col, int style);
| ^~~~~~~
/var/tmp/portage/media-radio/radiotray-ng-0.2.8/work/radiotray-ng-0.2.8/src/radiotray-ng/gui/editor/station_drop_target.cpp:134:69: error: ‘wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)’ is deprecated: use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants [-Werror=deprecated-declarations]
134 | dc.SetFont(wxFont(DRAG_FONT_POINT, wxSWISS, wxITALIC, wxBOLD));
| ^
/usr/include/wx-3.2-gtk3/wx/gtk/font.h:89:5: note: declared here
89 | wxFont(int size,
| ^~~~~~
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.
Yes, it would be great if a 0.2.9 could be official released.
Getting similiar warnings, but the compilation ends with success nevertheless. Try to change your compiler setting (cc1plus: all warnings being treated as errors).
Arch Linux wxwidgets-gtk3 3.2.5-1 wxwidgets-common 3.2.5-1
@zen2 could you please try this patch?
git diff CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 3826463..33d5c50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ endif(NOT APPLE) set(CMAKE_CXX_STANDARD 14) add_definitions("-DBOOST_LOG_DYN_LINK") add_compile_options("-fdiagnostics-color=auto") -set(warnings "-Wall -Wextra -Werror -Wpedantic") +set(warnings "-Wall -Wextra -Werror -Wpedantic -Wno-deprecated-declarations") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warnings}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${warnings}") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
I was more drastic and had removed -Werror to compile it. I'm using your patch right now and that fixed the error. Thanks.
so I close this ticket.