$ cat a.c #include "b.c" static int foo; int main(int argc, char ** argv) { foo=argc; // dummy code return foo; // dummy code } $ cat b.c static int foo; $ cc -Wall -pedantic a.c $ #### $ cat a.c #include "b.c" static int foo; int main(int argc, char ** argv) { foo=argc; // dummy code return foo; // dummy code } $ cat b.c static int foo = 42; $ cc -Wall -pedantic a.c $ #### $ cat a.c #include "b.c" static int foo = 42; int main(int argc, char ** argv) { foo=argc; // dummy code return foo; // dummy code } $ cat b.c static int foo = 42; $ cc -Wall -pedantic a.c a.c:3:12: error: redefinition of ‘foo’ 3 | static int foo = 42; | ^~~ In file included from a.c:1: b.c:1:12: note: previous definition of ‘foo’ with type ‘int’ 1 | static int foo = 42; | ^~~ b.c:1:12: warning: ‘foo’ defined but not used [-Wunused-variable] $ #### $ cc --version cc (Debian 12.2.0-14) 12.2.0 Copyright (C) 2022 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. $