STEPWAT2 defines several global variables in header files; the header files themselves are not protected against multiple includes; thus, these variables are defined multiple times (each time the header file is included):
duplicate symbol _mortality_rng in:
obj/ST_environs.o
obj/ST_grid.o
duplicate symbol _UseCheatgrassWildfire in:
obj/ST_environs.o
obj/ST_grid.o
...
Suggested solution: define these variables in code (instead of header) and declare as externed in header if needed
Also consider protecting header files from being included multiple times.
Quick fix until this issue is properly resolved: compile with option -fcommon
STEPWAT2 fails to compile with
gcc
versions 10 and later:gcc
starting with v10 changed the default from-fcommon
to-fno-common
, e.g., https://gcc.gnu.org/gcc-10/porting_to.htmlSTEPWAT2 defines several global variables in header files; the header files themselves are not protected against multiple includes; thus, these variables are defined multiple times (each time the header file is included):
Suggested solution: define these variables in code (instead of header) and declare as externed in header if needed
Also consider protecting header files from being included multiple times.
Quick fix until this issue is properly resolved: compile with option
-fcommon