Emanem / linux-hunter

Prototype MH:W companion app for Linux, inspired by SmartHunter
GNU General Public License v3.0
26 stars 9 forks source link

Fix GCC 11 compilation #11

Closed igo95862 closed 3 years ago

igo95862 commented 3 years ago

Per https://gcc.gnu.org/gcc-11/porting_to.html :

Header dependency changes Some C++ Standard Library headers have been changed to no longer include other headers that they do need to depend on.

  • (for std::numeric_limits)
Emanem commented 3 years ago

Can you test it with older g++ (i.e. g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0)? If this work (and should :) ) no reasons not to approve - code has to compile on current LTS distros.

igo95862 commented 3 years ago

Tested on Ubuntu 20.04 docker image:

root@123b936824fc:~/hunter# make
g++ -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  src/wdisplay.cpp -c -o obj/wdisplay.o
g++ -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  src/mhw_lookup.cpp -c -o obj/mhw_lookup.o
g++ -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  src/main.cpp -c -o obj/main.o
src/main.cpp: In function 'int main(int, char**)':
src/main.cpp:254:14: warning: unused variable 'optind' [-Wunused-variable]
  254 |   const auto optind = parse_args(argc, argv, argv[0], VERSION);
      |              ^~~~~~
g++ -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  src/utils.cpp -c -o obj/utils.o
g++ -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  src/ui.cpp -c -o obj/ui.o
g++ -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  src/fdisplay.cpp -c -o obj/fdisplay.o
g++ -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  src/memory.cpp -c -o obj/memory.o
g++ -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  src/patterns.cpp -c -o obj/patterns.o
g++ obj/wdisplay.o obj/mhw_lookup.o obj/main.o obj/utils.o obj/ui.o obj/fdisplay.o obj/memory.o obj/patterns.o  -o linux-hunter -g -Wall -std=c++11 -pthread -I/usr/include/ncursesw  -lncursesw 
root@123b936824fc:~/hunter# g++ --version
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
igo95862 commented 3 years ago

code has to compile on current LTS distros

Have you thought about setting up Github Actions Continuous Integration?

Emanem commented 3 years ago

Have you thought about setting up Github Actions Continuous Integration?

Unfortunately didn't/don't have time to look into this.