Compiling Angband on Windows with Visual Studio

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aodhlin
    Scout
    • Jul 2024
    • 26

    Compiling Angband on Windows with Visual Studio

    Hi!

    I'm trying to compile Angband using Visual Studio, following this guide --



    However, when I got to the "build" step, I got the following errors.

    Can anyone help me figure out what to do next?

    Thank you!

    Code:
    Severity Code Description Project File Line Suppression State Details
    Error (active) E1696 cannot open source file "unistd.h" AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\h-basic.h 121
    Error (active) E1696 cannot open source file "pwd.h" AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\h-basic.h 119
  • backwardsEric
    Knight
    • Aug 2019
    • 527

    #2
    When you followed step 2 of those instructions, did you create an empty win32 project? It looks like you are missing a preprocessor define (either _WINDOWS, __WINDOWS__, __WIN32__, WIN32, __WINNT__, or __NT__ would work), and I suspect that one of those should have been set if the appropriate project type had been selected.

    There's a couple of additional preprocessor defines that you may want to set in step 11 of those instructions: ALLOW_BORG (to enable the borg) and _CRT_SECURE_NO_WARNINGS (to disable some warnings that Microsoft's compiler likes to issue about some standard C library or Unix-compatibility functions).
    Last edited by backwardsEric; October 11, 2024, 14:15. Reason: Replaced BORG with the correct ALLOW_BORG

    Comment

    • Aodhlin
      Scout
      • Jul 2024
      • 26

      #3
      Originally posted by backwardsEric
      When you followed step 2 of those instructions, did you create an empty win32 project? It looks like you are missing a preprocessor define (either _WINDOWS, __WINDOWS__, __WIN32__, WIN32, __WINNT__, or __NT__ would work), and I suspect that one of those should have been set if the appropriate project type had been selected.

      There's a couple of additional preprocessor defines that you may want to set in step 11 of those instructions: BORG (to enable the borg) and _CRT_SECURE_NO_WARNINGS (to disable some warnings that Microsoft's compiler likes to issue about some standard C library or Unix-compatibility functions).
      OK, I experimented and got further.

      Now I'm getting the below errors, even though I included list-tvals.h in the project.

      Code:
      Severity Code Description Project File Line Suppression State Details
      Error C1083 Cannot open include file: 'list-tvals.h': No such file or directory AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\borg\borg-formulas.h 46
      Do I have to move the stuff out of the borg directory into the normal source directory?

      Comment

      • backwardsEric
        Knight
        • Aug 2019
        • 527

        #4
        All the other references to Angband's include files in the borg have "../" in front of the file name so that line in borg-formulas.h should be

        <CODE>
        #include "../list-tvals.h"
        </CODE>

        The builds we do on GitHub using the project files in src/win/vs2019 should have caught that; it's not clear to me why they didn't.

        Comment

        • Aodhlin
          Scout
          • Jul 2024
          • 26

          #5
          I've gotten similar errors. I'll experiment more a bit later.
          Code:
          Severity Code Description Project File Line Suppression State Details
          Error C1083 Cannot open include file: 'list-effects.h': No such file or directory AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\borg\borg-magic-play.c 38
          Error C1083 Cannot open include file: 'list-tvals.h': No such file or directory AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\borg\borg-formulas.c 60
          Error C1083 Cannot open include file: 'ui-menu.h': No such file or directory AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\borg\borg-item-decurse.c 24

          Comment

          • Aodhlin
            Scout
            • Jul 2024
            • 26

            #6
            Originally posted by Aodhlin
            I've gotten similar errors. I'll experiment more a bit later.
            Code:
            Severity Code Description Project File Line Suppression State Details
            Error C1083 Cannot open include file: 'list-effects.h': No such file or directory AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\borg\borg-magic-play.c 38
            Error C1083 Cannot open include file: 'list-tvals.h': No such file or directory AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\borg\borg-formulas.c 60
            Error C1083 Cannot open include file: 'ui-menu.h': No such file or directory AngbandTest C:\Users\dynam\source\repos\AngbandTest\AngbandTes t\src\borg\borg-item-decurse.c 24
            OK, I've managed to get Angband to compile using the Visual Studio project included in the zip. Disregard this.

            One note is that you need to make sure to be using a 32-bit compile, not 64-bit. Otherwise libpng gets mad.

            Comment

            • backwardsEric
              Knight
              • Aug 2019
              • 527

              #7
              On the same line as the 32-bit versus 64-bit issue, you'll have to build for an x86 target if you are using the versions of libpng and zlib packaged with the source code: those libraries are 32-bit and for x86 only. If you want to build for something that is not x86, you would need to replace those libraries.

              Comment

              Working...
              😀
              😂
              🥰
              😘
              🤢
              😎
              😞
              😡
              👍
              👎