From 3491ec7d5d7dd6364eff1b000ddfa41e6689a514 Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Sun, 3 May 2020 13:14:54 +0100 Subject: [PATCH] libdockapp: fix multiple definitions of global variable. The `display` variable is declared in wmgeneral.h with no explicit linkage. This may result in there being definitions of it in the library and the object-files of applications which link against it, which causes link failures when building these applications with GCC 10, since this uses -fno-common by default. Add `extern` to the header declaration and a separate declaration with no linkage in wmgeneral.c where it is initialized. Signed-off-by: Jeremy Sowden --- libdockapp/src/wmgeneral.c | 1 + libdockapp/src/wmgeneral.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libdockapp/src/wmgeneral.c b/libdockapp/src/wmgeneral.c index b491502..23e3fc6 100644 --- a/libdockapp/src/wmgeneral.c +++ b/libdockapp/src/wmgeneral.c @@ -75,6 +75,7 @@ /* X11 Variables */ /*****************/ +Display *display; Window Root; int screen; int x_fd; diff --git a/libdockapp/src/wmgeneral.h b/libdockapp/src/wmgeneral.h index c3454c5..03e7e92 100644 --- a/libdockapp/src/wmgeneral.h +++ b/libdockapp/src/wmgeneral.h @@ -66,7 +66,7 @@ typedef struct { /* Global variable */ /*******************/ -Display *display; +extern Display *display; /***********************/ /* Function Prototypes */ -- 2.11.4.GIT