Davidebyzero / Snipes

The classic 1982 text-mode game Snipes, ported from the original DOS executable with 100% identical game logic, with replay recording added
64 stars 11 forks source link

'make' errors in Ubuntu #4

Closed jukebox017 closed 7 years ago

jukebox017 commented 7 years ago

I cloned the repository and ran make, and got SDL errors. I installed libsdl2-dev which solved some of them, but I got the following errors:

make
g++ -o snipes -Werror -Wall -Wextra -std=c++11 -I/usr/include/SDL2 -D_REENTRANT -O3 Snipes.cpp sdl/console.cpp sdl/keyboard.cpp sdl/sound.cpp sdl/timer.cpp -L/usr/lib/x86_64-linux-gnu -lSDL2 -lm -lSDL2_ttf
Snipes.cpp: In function ‘int main(int, char**)’:
Snipes.cpp:2200:65: error: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
    fread(&random_seed_lo, sizeof(random_seed_lo), 1, replayFile);
                                                                 ^
Snipes.cpp:2201:65: error: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
    fread(&random_seed_hi, sizeof(random_seed_hi), 1, replayFile);
                                                                 ^
Snipes.cpp:2202:46: error: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
    fread(&skillLevelLetter, 1, 1, replayFile);
                                              ^
Snipes.cpp:2203:46: error: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
    fread(&skillLevelNumber, 1, 1, replayFile);
                                              ^
cc1plus: all warnings being treated as errors
sdl/console.cpp:4:26: fatal error: SDL2/SDL_ttf.h: No such file or directory
 #include <SDL2/SDL_ttf.h>
                          ^
compilation terminated.
GNUmakefile:10: recipe for target 'snipes' failed
make: *** [snipes] Error 1
CyberShadow commented 7 years ago

Looks like new GCC warnings. You can make them non-fatal by removing -Werror.

You also seem to be missing SDL2_ttf.

jukebox017 commented 7 years ago

Wow, that was the fastest response ever.

I removed -Werror from CFLAGS in the GNUmakefile which allowed it to compile. Also, I got SDL2_ttf by installing libsdl2-ttf-dev. But, on running snipes, I got:

./snipes
TTF_OpenFont: Couldn't open SnipesConsole.ttf
CyberShadow commented 7 years ago

The font is available separately, as it's a modification of a Microsoft font. http://kingbird.myphotos.cc/ee22d44076adb8a34d8e20df4be3730a/SnipesConsole.ttf It should be linked to from the only two places I'm aware of that link to this project (AUR package and Vogons thread).

jukebox017 commented 7 years ago

Awesome! Before your reply was posted, I changed FONT_FILENAME to a random .ttf font that I found. And it worked! snipes I played this game way back in the day so I was excited to find this repo and get it up and running. I'm sure adding this info to a Readme file can help other people who might stumble onto this :) Thanks for the help!