Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Development (http://angband.oook.cz/forum/forumdisplay.php?f=10)
-   -   Trouble compiling Angband (http://angband.oook.cz/forum/showthread.php?t=8779)

rjphares December 27, 2017 21:38

Trouble compiling Angband
 
I'm on Windows 8.1 using visual studio 2017. I get error: Error C1189 #error: Macro definition of snprintf conflicts with Standard Library function declaration Angband1 c:\program files (x86)\windows kits\10\include\10.0.16299.0\ucrt\stdio.h 1933

Please help. Thanks.

Nick December 27, 2017 21:48

Try going into the file src\h-basic.h, removing these lines:
Code:

/**
 * Native MSVC compiler doesn't understand inline or snprintf
 */
#ifdef _MSC_VER
#        define inline __inline
#        define snprintf _snprintf
#endif

and see what happens.

Those lines were apparently to deal with deficiencies in the Microsoft compiler which look like they may have been fixed. Let us know how you go.

rjphares December 27, 2017 23:32

I'm down to 4 errors:

Error (active) E0028 expression must have a constant value Angband1 c:\Users\Robert\source\repos\Angband1\Angband1\loa d.c 808

Error C2057 expected constant expression Angband1 c:\users\robert\source\repos\angband1\angband1\loa d.c 808

Error C2466 cannot allocate an array of constant size 0 Angband1 c:\users\robert\source\repos\angband1\angband1\loa d.c 808

Error C2133 'itypes': unknown size Angband1 c:\users\robert\source\repos\angband1\angband1\loa d.c 808


line 808 from load.c looks like:
Code:

        bitflag flags, itypes[itype_size];

Nick December 28, 2017 04:28

OK, you can safely replace itype_size with ITYPE_SIZE in that line, which should fix that problem.

rjphares December 28, 2017 17:53

2 errors:
Error LNK2001 unresolved external symbol _init_sound_win Angband1 C:\Users\Robert\source\repos\Angband1\Angband1\sou nd-core.obj 1

Error LNK1120 1 unresolved externals Angband1 C:\Users\Robert\source\repos\Angband1\Debug\Angban d1.exe 1

I may end up having to start over from the beginning.
This is what I did since the visual studio instructions are out of date:
  • Added libpng.dll and zlib1.dll to project directory.
  • Added zlib1.lib(no such file, I tried renaming) libpng.lib msimg32.lib winmm.lib to Properties->Linker->Input->Additional Dependencies
  • Added all src ".h" and ".c" files, excluding files with "main" and snd-sdl.c to project directory and project.
  • Added all src\win ".h" and ".c" files to project directory and project.
  • Added all src\win angband.rc and angband.ico files to project directory and project.
  • Added all src\win\include ".h" files to project directory and project.
  • Added main-win.c file to project directory and project.

rjphares January 11, 2018 20:00

I think I'm going to wait to compile until there is an update for visual studio instructions. Thanks for the help.

Nick January 11, 2018 22:37

Sorry, I missed your last post.

You could try replacing
Code:

errr init_sound_win(struct sound_hooks *hooks, int argc, char **argv);
in src/snd-win.h with
Code:

extern errr init_sound_win(struct sound_hooks *hooks, int argc, char **argv);
from where you were at that point, and see if that works.


All times are GMT +1. The time now is 11:28.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.