Support to C++11 (Compile error)
Closed this issue · 6 comments
I don't know if the errors listed below are due to the support the project currently has with C++17.
I have decided to list only the first five errors, however the list of errors is longer.
In file included from ../src/FLMain.cpp:23:0:
../src/lexical/FLTok.hpp:18:18: error: ‘CHKPTINT’ declared as an ‘inline’ variable
inline const int CHKPTINT = 400;
^
In file included from ../src/FLMain.cpp:26:0:
../src/core/FLInventory.hpp:23:18: error: ‘MAXINVEN’ declared as an ‘inline’ variable
inline const int MAXINVEN = 12;
^
../src/core/FLInventory.hpp:29:18: error: ‘MIN_LIMIT’ declared as an ‘inline’ variable
inline const int MIN_LIMIT = 10;
^
../src/core/FLInventory.hpp:34:18: error: ‘END_SENTINEL’ declared as an ‘inline’ variable
inline const int END_SENTINEL = 255;
^
In file included from ../src/FLMain.cpp:27:0:
../src/core/FLTermCapIO.hpp:44:18: error: ‘LINBUFSIZE’ declared as an ‘inline’ variable
inline const int LINBUFSIZE = 128;
I would be delighted to be a partner in the project if you can correct the corresponding errors.
I post information about my system:
SO: GNU/Linux 4.15.0-36-generic
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 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.
Thanks.
S.T.
Done. I have changed the offending inline variables into const's and moved around some of the variables into source files along with proper externs for the other declarations in other files. I liked inline variables because you can kind of 'cheat' with the declarations in headers for simplicity. Let me know if it works for you (I tried on GCC9) and on MingW and it seems to work ok.
There are still some errors, I leave the complete list:
g++ -c -std=c++11 -Winline -fno-elide-constructors -pipe -Wall -Wextra -Werror -pedantic-errors -Wpointer-arith -Woverloaded-virtual -Wuninitialized -Wshadow -Winit-self -Wmissing-declarations -fomit-frame-pointer -DNIX_LOCAL ../src/player/FLPlayerSpells.cpp -o ../src/player/FLPlayerSpells.o
../src/player/FLPlayerSpells.cpp: In function ‘int fl_direction(int*, int*)’:
../src/player/FLPlayerSpells.cpp:921:5: error: attributes at the beginning of statement are ignored [-Werror=attributes]
[[fallthrough]];
^
../src/player/FLPlayerSpells.cpp:924:5: error: attributes at the beginning of statement are ignored [-Werror=attributes]
[[fallthrough]];
^
../src/player/FLPlayerSpells.cpp:927:5: error: attributes at the beginning of statement are ignored [-Werror=attributes]
[[fallthrough]];
^
../src/player/FLPlayerSpells.cpp:930:5: error: attributes at the beginning of statement are ignored [-Werror=attributes]
[[fallthrough]];
^
../src/player/FLPlayerSpells.cpp:933:5: error: attributes at the beginning of statement are ignored [-Werror=attributes]
[[fallthrough]];
^
../src/player/FLPlayerSpells.cpp:936:5: error: attributes at the beginning of statement are ignored [-Werror=attributes]
[[fallthrough]];
^
../src/player/FLPlayerSpells.cpp:939:5: error: attributes at the beginning of statement are ignored [-Werror=attributes]
[[fallthrough]];
^
../src/player/FLPlayerSpells.cpp:943:5: error: attributes at the beginning of statement are ignored [-Werror=attributes]
[[fallthrough]];
cc1plus: all warnings being treated as errors
Damn I missed those. [[fallthrough]] is C++17 and I totally forgot :) it's fixed in master.
He's compiled! There's a problem though.
The following commit has an erroneous instruction:
Thanks.
T.S.
Not on GCC8. Probably it's the implicit fallthrough flag not being compatible with old GCC versions. I'll add the C/C++03 version and see if that makes any difference.
Should be completely clean now for building on GCC < 5 versions hopefully.