Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Compiling error caused by a possible typo and an unrecognized command line option -Wno-visibility #25

Open
jrcharney opened this issue Nov 22, 2018 · 1 comment

Comments

@jrcharney
Copy link

Since I figure this would be a simple enough game to run on a Raspberry Pi 3, I downloaded it to my Pi to try it out.

However, I encountered a couple of errors that need fixing.

$ make
cc -Wno-visibility -Wno-incompatible-pointer-types -Wall -Wextra -DINVERT_COLORS -DVT100 -O2 src/ai.c src/options.c src/main.c src/highscore.c src/engine.c src/merge_std.c src/gfx_terminal.c -o 2048
src/gfx_terminal.c: In function ‘gfx_draw’:
src/gfx_terminal.c:59:28: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘long int’ [-Wformat=]
                 printf("%*zd |", g->print_width, merge_value(g->grid[x][y]));
                            ^
src/gfx_terminal.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-visibility’

The first item is that typo on line 59 of gfx_terminal.c. Get rid of that z in that 'printf' statement.

The second item is that I've checked with just about every compiler (well, at least GCC and Clang documentation) and there is no such warning as -Wno-visibility. So you can drop that argument.

I'm going to try to make these corrections myself to see if that fixes everything.

@jrcharney
Copy link
Author

jrcharney commented Nov 22, 2018

Right...so I fixed the line. Try using this.

 printf("%*ld |", g->print_width, merge_value(g->grid[x][y]));

I figured since merge_value returns a long and since ld was used elsewhere, here would be a good place to use it.

Also, I removed the -Wno-visbility argument from the Makefile.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant