TomenetGame / tomenet

TomeNET is an online multiplayer roguelike role-playing game
https://www.tomenet.eu/
Other
69 stars 11 forks source link

Error when cross-compiling windows client on linux #26

Closed jezek closed 2 years ago

jezek commented 2 years ago

Hello,

when cross-compiling a windows executable on linux, this error is thrown:

make -f makefile.mingw tomenet.exe
...
i686-w64-mingw32-gcc -O2 -g -Wall -D__USE_W32_SOCKETS -DWIN32 -DDUMB_WIN -DMINGW -DMEXP=19937 -std=c99 -DACC32 -DWINVER=0x0501 -Wno-unused-but-set-variable -DSOUND_SDL -I/usr/i686-w64-mingw32/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main  -Iserver -Iserver/lua -o client/main-win.o -c client/main-win.c
client/main-win.c:3678:13: error: static declaration of ‘init_stuff’ follows non-static declaration
 3678 | static void init_stuff(void) {
      |             ^~~~~~~~~~
In file included from client/angband.h:52,
                 from client/main-win.c:72:
client/externs.h:529:13: note: previous declaration of ‘init_stuff’ with type ‘void(void)’
  529 | extern void init_stuff(void);
      |             ^~~~~~~~~~
make: *** [makefile.mingw:317: client/main-win.o] Error 1

I can fix this (and successfully build) by renaming the init_stuff function and it's caller in client/main-win.c. But I think better way would be to rename the extern definition, the function definition and its caller.

And I also wonder why the other people compiling windows executable don't suffer from this.

mhirki commented 2 years ago

Looks like compiling the Windows client happened to be broken when you tried it. It should be fixed with commits 9c46d723cf6e155c677a4b6063da5ed01126a499 and 7da02840574d7777d57d510eda18276b236d8401 so that it compiles again. The code is still a bit of a mess with multiple versions of init_stuff function.