2048-cli icon indicating copy to clipboard operation
2048-cli copied to clipboard

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

Open jrcharney opened this issue 6 years ago • 1 comments

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 avatar Nov 22 '18 17:11 jrcharney

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.

jrcharney avatar Nov 22 '18 17:11 jrcharney