View Single Post
Old 2021-01-17, 16:38   #8
EdH's Avatar
"Ed Hall"
Dec 2009
Adirondack Mtns

ED016 Posts

Originally Posted by VBCurtis View Post
If there's a flag that "defaults to -fno-common", can't we (well, you) just set that flag the opposite way at compile time?
The page referenced earlier does suggest:
Originally Posted by Porting to GCC 10
As a workaround, legacy C code where all tentative definitions should be placed into a common block can be compiled with -fcommon.
I have tried using this flag in a variety of places within the YAFU Makefile, with no success.

Originally Posted by mathwiz View Post
Perhaps, but it seems like sticking in the extern's is the more syntactically correct approach, and should work with all gcc versions without the need to fiddle with compiler flags...
The error file from a compile attempt resulted in 3876 "multiple definitions." This represents a substantial amount of work to resolve by editing to include "extern."

I am looking at a project to write a script to do all this editing based on the list of multiple definitions. But, my concern is that all the first instances of each definition did not flag the error. Should all those instances also include "extern," or, is a single point that doesn't, have to exist? If the latter, is there a correct place for the initial definition, such as the main code block?
EdH is offline   Reply With Quote