Skip to content

failure to compile #31

Description

@matlacki

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:

  1. cut lines 52-58 from SDL_extras and replace with #include SDL_extras2.h
  2. 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
  1. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions