Fedora35 Compilation Error
Closed this issue · 2 comments
[devfedora@dev build]$ sudo make
[sudo] hasło użytkownika devfedora:
[ 1%] Building CXX object CMakeFiles/rme.dir/source/about_window.cpp.o
[ 2%] Building CXX object CMakeFiles/rme.dir/source/action.cpp.o
[ 3%] Building CXX object CMakeFiles/rme.dir/source/application.cpp.o
In file included from /usr/include/wx-3.1/wx/wx.h:24,
from /home/devfedora/RME/rme/source/main.h:59,
from /home/devfedora/RME/rme/source/application.cpp:18:
/home/devfedora/RME/rme/source/gui.h:66:32: warning: cast between incompatible pointer to member types from ‘void (wxEvtHandler::)(wxCommandEvent&)’ to ‘wxEventFunction’ {aka ‘void (wxEvtHandler::)(wxEvent&)’} [-Wcast-function-type]
66 | (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, &fn ),
/home/devfedora/RME/rme/source/application.cpp:53:9: note: in expansion of macro ‘EVT_ON_UPDATE_MENUS’
53 | EVT_ON_UPDATE_MENUS(wxID_ANY, MainFrame::OnUpdateMenus)
| ^~~~~~~~~~~~~~~~~~~
[ 4%] Building CXX object CMakeFiles/rme.dir/source/artprovider.cpp.o
[ 5%] Building CXX object CMakeFiles/rme.dir/source/basemap.cpp.o
[ 6%] Building CXX object CMakeFiles/rme.dir/source/brush.cpp.o
[ 7%] Building CXX object CMakeFiles/rme.dir/source/brush_tables.cpp.o
[ 8%] Building CXX object CMakeFiles/rme.dir/source/browse_tile_window.cpp.o
[ 9%] Building CXX object CMakeFiles/rme.dir/source/positionctrl.cpp.o
[ 10%] Building CXX object CMakeFiles/rme.dir/source/carpet_brush.cpp.o
[ 11%] Building CXX object CMakeFiles/rme.dir/source/client_version.cpp.o
[ 12%] Building CXX object CMakeFiles/rme.dir/source/common.cpp.o
[ 13%] Building CXX object CMakeFiles/rme.dir/source/common_windows.cpp.o
[ 14%] Building CXX object CMakeFiles/rme.dir/source/complexitem.cpp.o
[ 15%] Building CXX object CMakeFiles/rme.dir/source/container_properties_window.cpp.o
[ 16%] Building CXX object CMakeFiles/rme.dir/source/copybuffer.cpp.o
[ 17%] Building CXX object CMakeFiles/rme.dir/source/creature_brush.cpp.o
[ 18%] Building CXX object CMakeFiles/rme.dir/source/creature.cpp.o
[ 19%] Building CXX object CMakeFiles/rme.dir/source/creatures.cpp.o
[ 20%] Building CXX object CMakeFiles/rme.dir/source/dat_debug_view.cpp.o
[ 21%] Building CXX object CMakeFiles/rme.dir/source/dcbutton.cpp.o
[ 22%] Building CXX object CMakeFiles/rme.dir/source/doodad_brush.cpp.o
[ 23%] Building CXX object CMakeFiles/rme.dir/source/editor.cpp.o
[ 25%] Building CXX object CMakeFiles/rme.dir/source/editor_tabs.cpp.o
[ 26%] Building CXX object CMakeFiles/rme.dir/source/eraser_brush.cpp.o
[ 27%] Building CXX object CMakeFiles/rme.dir/source/extension.cpp.o
[ 28%] Building CXX object CMakeFiles/rme.dir/source/extension_window.cpp.o
[ 29%] Building CXX object CMakeFiles/rme.dir/source/find_item_window.cpp.o
[ 30%] Building CXX object CMakeFiles/rme.dir/source/filehandle.cpp.o
[ 31%] Building CXX object CMakeFiles/rme.dir/source/graphics.cpp.o
[ 32%] Building CXX object CMakeFiles/rme.dir/source/ground_brush.cpp.o
[ 33%] Building CXX object CMakeFiles/rme.dir/source/gui.cpp.o
/home/devfedora/RME/rme/source/gui.cpp: In static member function ‘static wxString GUI::GetDataDirectory()’:
/home/devfedora/RME/rme/source/gui.cpp:142:20: warning: catching polymorphic type ‘class std::bad_cast’ by value [-Wcatch-value=]
142 | catch(std::bad_cast)
| ^~~~~~~~
/home/devfedora/RME/rme/source/gui.cpp: In static member function ‘static wxString GUI::GetExecDirectory()’:
/home/devfedora/RME/rme/source/gui.cpp:159:20: warning: catching polymorphic type ‘class std::bad_cast’ by value [-Wcatch-value=]
159 | catch(std::bad_cast)
| ^~~~~~~~
[ 34%] Building CXX object CMakeFiles/rme.dir/source/house_brush.cpp.o
[ 35%] Building CXX object CMakeFiles/rme.dir/source/house.cpp.o
/home/devfedora/RME/rme/source/house.cpp: In member function ‘void Houses::addHouse(House*)’:
/home/devfedora/RME/rme/source/house.cpp:46:28: warning: variable ‘it’ set but not used [-Wunused-but-set-variable]
46 | HouseMap::iterator it = houses.find(new_house->id);
| ^~
[ 36%] Building CXX object CMakeFiles/rme.dir/source/house_exit_brush.cpp.o
[ 37%] Building CXX object CMakeFiles/rme.dir/source/iomap.cpp.o
[ 38%] Building CXX object CMakeFiles/rme.dir/source/iomap_otbm.cpp.o
[ 39%] Building CXX object CMakeFiles/rme.dir/source/item_attributes.cpp.o
/home/devfedora/RME/rme/source/item_attributes.cpp: In member function ‘bool ItemAttribute::unserialize(const IOMap&, BinaryNode*)’:
/home/devfedora/RME/rme/source/item_attributes.cpp:340:9: warning: ‘rtype’ may be used uninitialized in this function [-Wmaybe-uninitialized]
340 | switch(rtype) {
| ^~~~~~
[ 40%] Building CXX object CMakeFiles/rme.dir/source/item.cpp.o
[ 41%] Building CXX object CMakeFiles/rme.dir/source/items.cpp.o
[ 42%] Building CXX object CMakeFiles/rme.dir/source/live_action.cpp.o
[ 43%] Building CXX object CMakeFiles/rme.dir/source/live_client.cpp.o
[ 44%] Building CXX object CMakeFiles/rme.dir/source/live_peer.cpp.o
[ 45%] Building CXX object CMakeFiles/rme.dir/source/live_server.cpp.o
[ 46%] Building CXX object CMakeFiles/rme.dir/source/live_socket.cpp.o
/home/devfedora/RME/rme/source/live_socket.cpp: In member function ‘Tile* LiveSocket::readTile(BinaryNode*, Editor&, const Position*)’:
/home/devfedora/RME/rme/source/live_socket.cpp:310:52: warning: ‘z’ may be used uninitialized in this function [-Wmaybe-uninitialized]
310 | uint8_t z; node->getU8(z); pos.z = z;
| ^
/home/devfedora/RME/rme/source/live_socket.cpp:309:54: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
309 | uint16_t y; node->getU16(y); pos.y = y;
| ^
/home/devfedora/RME/rme/source/live_socket.cpp:308:54: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized]
308 | uint16_t x; node->getU16(x); pos.x = x;
| ^
/home/devfedora/RME/rme/source/live_socket.cpp:300:34: warning: ‘tileType’ may be used uninitialized in this function [-Wmaybe-uninitialized]
300 | if(tileType != OTBM_TILE && tileType != OTBM_HOUSETILE) {
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 47%] Building CXX object CMakeFiles/rme.dir/source/live_tab.cpp.o
[ 48%] Building CXX object CMakeFiles/rme.dir/source/main_menubar.cpp.o
/home/devfedora/RME/rme/source/main_menubar.cpp: In constructor ‘MainMenuBar::MainMenuBar(MainFrame*)’:
/home/devfedora/RME/rme/source/main_menubar.cpp:210:48: warning: cast between incompatible pointer to member types from ‘wxCommandEventFunction’ {aka ‘void (wxEvtHandler::)(wxCommandEvent&)’} to ‘wxEventFunction’ {aka ‘void (wxEvtHandler::)(wxEvent&)’} [-Wcast-function-type]
210 | (wxObjectEventFunction)(wxEventFunction)(ai->second->handler), nullptr, this);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/devfedora/RME/rme/source/main_menubar.cpp: In member function ‘bool MainMenuBar::Load(const FileName&, wxArrayString&, wxString&)’:
/home/devfedora/RME/rme/source/main_menubar.cpp:527:91: error: ‘REPLACE_ITEM’ is not a member of ‘MenuBar’; did you mean ‘REPLACE_ITEMS’?
527 | entries[3].Set(wxACCEL_CTRL | wxACCEL_SHIFT, (int)'F', MAIN_FRAME_MENU + MenuBar::REPLACE_ITEM);
| ^~~~~~~~~~~~
| REPLACE_ITEMS
make[2]: *** [CMakeFiles/rme.dir/build.make:720: CMakeFiles/rme.dir/source/main_menubar.cpp.o] Błąd 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/rme.dir/all] Błąd 2
make: *** [Makefile:91: all] Błąd 2
Now I have this problem:
[ 81%] Building CXX object CMakeFiles/rme.dir/source/spawn_brush.cpp.o /home/devfedora/RME/rme/source/replace_items_window.cpp: In member function ‘void ReplaceItemsDialog::OnExecuteButtonClicked(wxCommandEvent&)’: /home/devfedora/RME/rme/source/replace_items_window.cpp:368:41: error: ‘clamp’ is not a member of ‘std’ 368 | progress->SetValue(std::clamp<int>(value, 0, 100)); | ^~~~~ /home/devfedora/RME/rme/source/replace_items_window.cpp:368:47: error: expected primary-expression before ‘int’ 368 | progress->SetValue(std::clamp<int>(value, 0, 100)); | ^~~ make[2]: *** [CMakeFiles/rme.dir/build.make:1084: CMakeFiles/rme.dir/source/replace_items_window.cpp.o] Błąd 1 make[2]: *** Oczekiwanie na niezakończone zadania.... make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/rme.dir/all] Błąd 2 make: *** [Makefile:91: all] Błąd 2
for the error: ‘clamp’ is not a member of ‘std’, it's due cmake is using C++11 that has no "clamp" on standard class.
add these lines below "set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")" in CMakeLists.txt on root directory:
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
the new error caused by C++17:
[ 23%] Building CXX object CMakeFiles/rme.dir/source/editor.cpp.o
In file included from /usr/include/wx-3.1/wx/wx.h:24,
from /home/thiago/Sources/rme/source/main.h:59,
from /home/thiago/Sources/rme/source/dat_debug_view.cpp:18:
/usr/include/wx-3.1/wx/event.h: In instantiation of ‘constexpr auto wxPrivate::DoCast(void (C::)(E&)) [with E = wxCommandEvent; C = DatDebugView]’:
/home/thiago/Sources/rme/source/dat_debug_view.cpp:88:2: required from here
/usr/include/wx-3.1/wx/event.h:161:12: error: ‘wxEvtHandler’ is an inaccessible base of ‘DatDebugView’
161 | return static_cast<void (wxEvtHandler::)(E&)>(pmf);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/wx-3.1/wx/event.h:161:12: note: in pointer to member function conversion
make[2]: *** [CMakeFiles/rme.dir/build.make:342: CMakeFiles/rme.dir/source/dat_debug_view.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/rme.dir/all] Error 2
make: *** [Makefile:91: all] Error 2