From 19f91370568167b5a32d8cd5324d072d1727a6bd Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Thu, 23 Apr 2020 09:43:31 +0100 Subject: [PATCH] wmmoonclock: fix multiple definitions of some global variables. A number of variables are declared in a header with no explicit linkage. This results in there being definitions of them in multiple object files, which causes a link failure with GCC 10, since this uses -fno-common by default. Add `extern` to the header declarations and separate declarations with no linkage in xutils.c where they are assigned. Link: https://bugs.debian.org/957950 Signed-off-by: Jeremy Sowden --- wmmoonclock/src/xutils.c | 9 +++++++++ wmmoonclock/src/xutils.h | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/wmmoonclock/src/xutils.c b/wmmoonclock/src/xutils.c index b313d53..dc12f93 100644 --- a/wmmoonclock/src/xutils.c +++ b/wmmoonclock/src/xutils.c @@ -40,6 +40,15 @@ +/* + * Global variable + */ +Display *display; +Window Root; +Window iconwin, win; +int screen; +int DisplayDepth; + /* * X11 Variables */ diff --git a/wmmoonclock/src/xutils.h b/wmmoonclock/src/xutils.h index f9fc538..5edebec 100644 --- a/wmmoonclock/src/xutils.h +++ b/wmmoonclock/src/xutils.h @@ -20,11 +20,11 @@ typedef struct { /* * Global variable */ -Display *display; -Window Root; -Window iconwin, win; -int screen; -int DisplayDepth; +extern Display *display; +extern Window Root; +extern Window iconwin, win; +extern int screen; +extern int DisplayDepth;