Compiling a "Windows Console" version

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dean Anderson
    Adept
    • Nov 2009
    • 193

    Compiling a "Windows Console" version

    Hi All,

    This is my first post here, but some of you may remember me from a few years ago (I wrote the Cthangband and Hellband variants).

    After a long hiatus, I've got into Angband again, but I'm having trouble with the latest source.

    I notice on the download page that the older versions (e.g. 3.0.9) have "Windows Console" versions for download, but the latest version (3.1.1 beta) doesn't.

    How do I compile the "Windows Console" version for myself? Do I need to include a different "main-???" file other than "main-win"? Or do I include "main-win" but set various compiler options?

    I have Visual Studio 2008, if that helps.
  • konijn_
    Hellband maintainer
    • Jul 2007
    • 367

    #2
    Originally posted by Dean Anderson
    Hi All,

    This is my first post here, but some of you may remember me from a few years ago (I wrote the Cthangband and Hellband variants).

    After a long hiatus, I've got into Angband again, but I'm having trouble with the latest source.

    I notice on the download page that the older versions (e.g. 3.0.9) have "Windows Console" versions for download, but the latest version (3.1.1 beta) doesn't.

    How do I compile the "Windows Console" version for myself? Do I need to include a different "main-???" file other than "main-win"? Or do I include "main-win" but set various compiler options?

    I have Visual Studio 2008, if that helps.

    Wow, the man himself
    I have sent you several emails to which you never replied so I thought you had fallen from the face of the earth
    I kind of took over Hellband, you might want to give it a spin ;]

    T.
    * Are you ready for something else ? Hellband 0.8.8 is out! *

    Comment

    • Magnate
      Angband Devteam member
      • May 2007
      • 5110

      #3
      Hi. I have a nasty suspicion that you mean main-ibm.c, which was (IIRC) removed during the GPL effort. Also known as the "DOS" port. I noticed only yesterday that it wasn't there any more. Best ask Takkaria if there's any scope for resurrecting it - not sure how much was un-GPL-able.
      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

      Comment

      • Dean Anderson
        Adept
        • Nov 2009
        • 193

        #4
        Originally posted by Magnate
        Hi. I have a nasty suspicion that you mean main-ibm.c, which was (IIRC) removed during the GPL effort. Also known as the "DOS" port. I noticed only yesterday that it wasn't there any more. Best ask Takkaria if there's any scope for resurrecting it - not sure how much was un-GPL-able.
        It might have been, but I'm doubtful. The "main-ibm.c" version was a DOS version - and should therefore run inside something like DOSBox - but DOSBox refuses to run the "Windows Console" version of 3.0.9 claiming it isn't a DOS executable...

        I'll download the 3.0.9 source-code and see if that still includes "main-ibm.c"...

        ETA: I've just checked, and the 3.0.9 source doesn't include "main-ibm.c", so it can't have been that unless someone manually patched it.
        Last edited by Dean Anderson; November 30, 2009, 20:39. Reason: Add info

        Comment

        • Dean Anderson
          Adept
          • Nov 2009
          • 193

          #5
          Originally posted by konijn_
          Wow, the man himself
          I have sent you several emails to which you never replied so I thought you had fallen from the face of the earth
          Sorry about that - I haven't checked that email address in years...

          I kind of took over Hellband, you might want to give it a spin ;]

          T.
          I'll do that.

          Comment

          • d_m
            Angband Devteam member
            • Aug 2008
            • 1517

            #6
            Originally posted by Dean Anderson
            This is my first post here, but some of you may remember me from a few years ago (I wrote the Cthangband and Hellband variants).
            Hi Dean,

            Thanks so much for writing Cthangband. Back in college that variant was my favorite and really got me into Angband variants in general.

            Anyway, welcome to the forums!
            linux->xterm->screen->pmacs

            Comment

            • Dean Anderson
              Adept
              • Nov 2009
              • 193

              #7
              Found it (I think!)

              The "makefile.win" file allows you to define the "USE_CONSOLE" variable, and that causes it to include "main_gcu.c" instead of "main_win.c". However, it requires the Windows version of the PDCurses library if you want to use it on Windows.

              Hopefully, I'll be able to shoehorn that into a Visual Studio project and get it to work (I can't stand makefiles - I much prefer an IDE with an integrated debugger...)

              Comment

              • konijn_
                Hellband maintainer
                • Jul 2007
                • 367

                #8
                Originally posted by Dean Anderson
                Found it (I think!)

                The "makefile.win" file allows you to define the "USE_CONSOLE" variable, and that causes it to include "main_gcu.c" instead of "main_win.c". However, it requires the Windows version of the PDCurses library if you want to use it on Windows.

                Hopefully, I'll be able to shoehorn that into a Visual Studio project and get it to work (I can't stand makefiles - I much prefer an IDE with an integrated debugger...)
                Awesome, let me know if you can make hellband work in that IDE as well, I could use a debugger as well

                T.
                * Are you ready for something else ? Hellband 0.8.8 is out! *

                Comment

                • Dean Anderson
                  Adept
                  • Nov 2009
                  • 193

                  #9
                  Originally posted by konijn_
                  Awesome, let me know if you can make hellband work in that IDE as well, I could use a debugger as well

                  T.
                  Depends how much you've changed it, but all my Hellband code was written in Visual Studio in the first place, so you should be able to simply create a project (A Win32 Application - make sure you click the "Empty Project" option) and add the files...

                  Comment

                  • konijn_
                    Hellband maintainer
                    • Jul 2007
                    • 367

                    #10
                    Originally posted by Dean Anderson
                    Depends how much you've changed it, but all my Hellband code was written in Visual Studio in the first place, so you should be able to simply create a project (A Win32 Application - make sure you click the "Empty Project" option) and add the files...
                    I did not change much to the structure of the game.
                    For giggles, I created a new Win32 app, put c files under Source Files, h files under Header Files and angband.res and angband.rc under resource files.

                    Then I noticed a booboo where MS is less forgiving than GNU

                    Code:
                    /*
                     * Birth item info
                     */
                    typedef struct birth_item birth_item;
                    struct birth_item
                    {
                    	byte race;				/* Race of the counterpart */
                    	byte class;			/* Class of the counterpart */
                    had to become

                    t
                    Code:
                    ypedef struct birth_item birth_item;
                    struct birth_item
                    {
                    	byte prace;				/* Race of the counterpart */
                    	byte [B]p[/B]class;			/* Class of the counterpart */
                    Still, it seem that there are header problems, every single variable that is extern cannot be found when linking birth.c

                    1>birth.obj : error LNK2001: unresolved external symbol "struct player_race p_race" (?p_race@@3Uplayer_race@@A)
                    1>birth.obj : error LNK2001: unresolved external symbol "char reallyTRUE" (?reallyTRUE@@3DA)
                    1>birth.obj : error LNK2019: unresolved external symbol "unsigned long __cdecl Rand_div(unsigned long)" (?Rand_div@@YAKK@Z) referenced in function "void __cdecl create_random_name(int,unsigned char,char *)" (?create_random_name@@YAXHEPAD@Z)
                    1>birth.obj : error LNK2019: unresolved external symbol "unsigned long __cdecl Rand_num(unsigned long)" (?Rand_num@@YAKK@Z) referenced in function "void __cdecl create_random_name(int,unsigned char,char *)" (?create_random_name@@YAXHEPAD@Z)
                    1>birth.obj : error LNK2001: unresolved external symbol "char rand_unbiased" (?rand_unbiased@@3DA)

                    And this ad nauseum until 101 thingies are not found, and thats the end of it.

                    T.
                    * Are you ready for something else ? Hellband 0.8.8 is out! *

                    Comment

                    • konijn_
                      Hellband maintainer
                      • Jul 2007
                      • 367

                      #11
                      Gah,

                      1>angband.res : warning LNK4078: multiple '.rsrc' sections found with different attributes (40000040)
                      1>dungeon.obj : error LNK2019: unresolved external symbol _player_birth referenced in function _play_game
                      1>C:\Documents and Settings\demuyt\My Documents\Visual Studio 2008\Projects\hellband\Debug\hellband.exe : fatal error LNK1120: 1 unresolved externals
                      1>Build log was saved at "file://c:\Documents and Settings\demuyt\My Documents\Visual Studio 2008\Projects\hellband\hellband\Debug\BuildLog.htm "
                      1>hellband - 2 error(s), 1071 warning(s)

                      Less errors but just as annoying, not sure what to do.
                      * Are you ready for something else ? Hellband 0.8.8 is out! *

                      Comment

                      • konijn_
                        Hellband maintainer
                        • Jul 2007
                        • 367

                        #12
                        Current situation, rebuild a new project, it compiles!!

                        Too bad it doesnt like the resource file at all, so I am stuck at the first screen

                        Too bad that Visual Studio 2008 does not allow resource editing.

                        T.
                        * Are you ready for something else ? Hellband 0.8.8 is out! *

                        Comment

                        • konijn_
                          Hellband maintainer
                          • Jul 2007
                          • 367

                          #13
                          It's alive, I had to go back to the original main-win.c, which is too bad since now Hellband does not resize any more, oh well.

                          Thanks for your input guys!

                          T.
                          * Are you ready for something else ? Hellband 0.8.8 is out! *

                          Comment

                          • Dean Anderson
                            Adept
                            • Nov 2009
                            • 193

                            #14
                            Well, I'm stuck again...

                            I got the 3.1.1 source.

                            I flattened the folder structure to get rid of the "/object", "/player" and "/monster" subfolders (this meant renaming a couple of files and updating "#include" statements accordingly).

                            I created an empty VS2008 C project.

                            I added all the source files (.c and .h, except for the various main-???.c files)

                            I added main-gcu.c

                            I defined "WINDOWS", "USE_GCU" and "WIN32_CONSOLE_MODE"

                            I compiled...

                            ...And it complained that it couldn't find <curses.h>

                            Fair enough, it needs a version of the Curses library.

                            So I downloaded PDCurses and added it to the list of "Include" folders.

                            I compiled...

                            ...And it complains that it can't find <term.h>

                            And now I'm stuck. I can't find any "term.h" file as part of the MinGW install, the PDCurses install or the VS2008 install.

                            Does anyone know where I can find it? (And presumably the .lib or .dll file that accompanies it?)

                            Comment

                            • konijn_
                              Hellband maintainer
                              • Jul 2007
                              • 367

                              #15
                              Originally posted by Dean Anderson
                              Well, I'm stuck again...

                              <SNIP>
                              ...And it complains that it can't find <term.h>

                              And now I'm stuck. I can't find any "term.h" file as part of the MinGW install, the PDCurses install or the VS2008 install.

                              Does anyone know where I can find it? (And presumably the .lib or .dll file that accompanies it?)
                              Sure,


                              Its in the root folder.
                              That is one of the other zip files which is not part of the 'newest files', so its not obvious you need this zip file as well.

                              T.
                              * Are you ready for something else ? Hellband 0.8.8 is out! *

                              Comment

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