-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Hi,
I just downloaded the git version of the source code. It does not compile under Linux Ubuntu 23.10 with the following error.
titlescreen.c:566:9: warning: implicit declaration of function ‘T4K_Tts_say’ [-Wimplicit-function-declaration]
titlescreen.c:638:59: error: ‘white’ undeclared (first use in this function); did you mean ‘write’?
638 | s1 = T4K_BlackOutline(strings[i], font_size, &white);
| ^~~~~
| write
titlescreen.c:638:59: note: each undeclared identifier is reported only once for each function it appears in
titlescreen.c: In function ‘ShowMessage’:
titlescreen.c:755:57: error: ‘white’ undeclared (first use in this function); did you mean ‘write’?
755 | s1 = T4K_BlackOutline(str1, font_size * scale, &white);
The reason is "white" is defined in SDL_extras.h which is not included in titlescreen.h. For example object file theme.o is being created, despite use of "&white" but there SDL_extras.h is included in theme.h. Adding "#include SDL_extras.h" to the titlescreen.h does not solve the issue as then there is conflict between
In file included from titlescreen.h:83:
/usr/include/t4k_common.h:189:1: error: conflicting types for ‘sprite’; have ‘struct ’
189 | sprite;
| ^~~~~~
SDL_extras.h:75:3: note: previous declaration of ‘sprite’ with type ‘sprite’
75 | } sprite;
| ^~~~~~
I found a solution:
- cut lines 52-58 from SDL_extras and replace with #include SDL_extras2.h
- create SDL_extras2.h
#ifndef SDL_EXTRAS2_H
#define SDL_EXTRAS2_H
/* the colors we use throughout the game */
static const SDL_Color black = {0x00, 0x00, 0x00, 0x00};
static const SDL_Color gray = {0x80, 0x80, 0x80, 0x00};
static const SDL_Color dark_blue = {0x00, 0x00, 0x60, 0x00};
static const SDL_Color red = {0xff, 0x00, 0x00, 0x00};
static const SDL_Color white = {0xff, 0xff, 0xff, 0x00};
static const SDL_Color yellow = {0xff, 0xff, 0x00, 0x00};
#endif
- add #include "SDL_extras2.h" in the titlescreen.h file after #include's " SDL_*.h"
Then the code compiles (linking fails for be but it is a progress).