From 8bba55df41de8cef9d4db6eabfaa77fc845cc0ac Mon Sep 17 00:00:00 2001 From: Grigory Ustinov Date: Mon, 21 Dec 2020 18:56:41 +0300 Subject: [PATCH] Make gcc10 happy gcc-10 and above flipped a default from -fcommon to -fno-common. So now GCC will reject multiple definitions of global variables. --- src/cursor.c | 2 ++ src/deck.c | 2 ++ src/game.h | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cursor.c b/src/cursor.c index 50536cf..f8c58fb 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -8,6 +8,8 @@ #include "game.h" #include "common.h" +struct cursor *cursor; + void cursor_malloc(struct cursor **cursor) { if (!(*cursor = malloc(sizeof(**cursor)))) { tty_solitaire_generic_error(errno, __FILE__, __LINE__); diff --git a/src/deck.c b/src/deck.c index 8eb25d7..527edbd 100644 --- a/src/deck.c +++ b/src/deck.c @@ -5,6 +5,8 @@ #include "deck.h" #include "common.h" +struct deck *deck; + void deck_malloc(struct deck **deck) { if (!(*deck = malloc(sizeof(**deck)))) { tty_solitaire_generic_error(errno, __FILE__, __LINE__); diff --git a/src/game.h b/src/game.h index acd6d04..24a8f0f 100644 --- a/src/game.h +++ b/src/game.h @@ -35,8 +35,8 @@ struct game { int four_color_deck; }; -struct deck *deck; -struct cursor *cursor; +extern struct deck *deck; +extern struct cursor *cursor; bool maneuvre_stack(struct stack *); bool stock_stack(struct stack *); -- 2.25.4