Compiling 3.2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Omnipact
    Rookie
    • Jun 2007
    • 23

    Compiling 3.2

    So I'm trying to compile Angband on WinXP with the SDL frontend...
    I'm using code::blocks with the mingw stuff.

    I get some very strange warnings:

    Code:
    ||=== Angband, Debug ===|
    C:\SDL-1.2.14\include\SDL_config.h|74|warning: "HAVE_STDINT_H" redefined|
    C:\angband-3.2.0\src\h-basic.h|38|warning: this is the location of the previous definition|
    C:\angband-3.2.0\src\main-sdl.c||In function 'Term_xtra_sdl_event':|
    C:\angband-3.2.0\src\main-sdl.c|2738|warning: implicit declaration of function 'usleep'|
    C:\SDL-1.2.14\include\SDL_config.h|74|warning: "HAVE_STDINT_H" redefined|
    C:\angband-3.2.0\src\h-basic.h|38|warning: this is the location of the previous definition|
    C:\angband-3.2.0\src\z-file.c||In function 'file_read':|
    C:\angband-3.2.0\src\z-file.c|484|warning: implicit declaration of function 'fileno'|
    ||=== Build finished: 0 errors, 6 warnings ===|
    The linker, however, does not fall over and I get a working Angband executable. (the 'implicit declarations' are called correctly)

    Out of curiosity I then compiled 3.1.2 to see what happened...
    It compiled perfectly with no warnings or errors. (it still uses usleep & fileno)

    Another thing I tried was to add all the -Wxxx switches (from makefile.std)to the build and got over 300 warnings! Mainly 'unused parameter' & 'no previous declaration' errors.

    I also couldn't compile unless I set '-std=c99' (which is not in makefile.std)

    A few questions:

    Has anyone else tried compiling a windows/SDL build of 3.2?

    Any idea what those warnings are about? - Am I doing something daft?

    Does anyone else compile with the -Wxxx settings on?
    (There are a lot of unused parameters)

    Oh yeah, and have a very merry christmas people!

    Iain
  • Magnate
    Angband Devteam member
    • May 2007
    • 5110

    #2
    We did have to go to -std=c99, so not sure why that wasn't in the Makefile. Sorry. Do you still get all those warnings after that is set? The main problem is that none of the developers are using Windows so we cross-compile. Native windows compilation doesn't get a lot of testing.
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

    Comment

    • Omnipact
      Rookie
      • Jun 2007
      • 23

      #3
      I still get the weird warnings even with c99 switched on.

      I only used the makefile to see what flags to use to compile.
      It was shocking to see 300-odd warnings with -Wall etc on though...

      Comment

      • takkaria
        Veteran
        • Apr 2007
        • 1951

        #4
        Originally posted by Omnipact
        I still get the weird warnings even with c99 switched on.

        I only used the makefile to see what flags to use to compile.
        It was shocking to see 300-odd warnings with -Wall etc on though...
        Pretty much 100% of them are fluff...

        The redefinition problems come because we autodetect compilers that allow us to use C99 int types and apparently does SDL. Wrapping the defines in ifndefs probably makes sense, even if it is a bit icky.
        takkaria whispers something about options. -more-

        Comment

        • APWhite
          Adept
          • Jul 2007
          • 244

          #5
          I use Visual Studio 2008 and I seem to have trouble with the subdirectories and the header files. z-info.c calls for #include "unit-test.h" but it is found in "tests/unit-test.h" and VS2008 can't seem to find it (even though it is in the project). I tried rewriting it to #include "Angband320/src/tests/unit-test.h" But it still fails. Anyone know how to get VS2008 to automatically scan the subdirectories or do I need to flatten all them out and move them in to the src directory?

          Andrew
          St George Chiropractor
          Angband Borg Homepage

          Comment

          • Omnipact
            Rookie
            • Jun 2007
            • 23

            #6
            Originally posted by APWhite
            I use Visual Studio 2008 and I seem to have trouble with the subdirectories and the header files. z-info.c calls for #include "unit-test.h" but it is found in "tests/unit-test.h" and VS2008 can't seem to find it (even though it is in the project). I tried rewriting it to #include "Angband320/src/tests/unit-test.h" But it still fails. Anyone know how to get VS2008 to automatically scan the subdirectories or do I need to flatten all them out and move them in to the src directory?
            I usually go through the brute force and ignorance route:
            Find your compiler search directories and just add directories. (maybe linker too - depends where the .o files are put).


            Or maybe rewrite the whole path (with drive name) in the #include :
            #include "C:/Angband320/src/tests/unit-test.h"

            Iain

            Comment

            • Dean Anderson
              Adept
              • Nov 2009
              • 193

              #7
              Originally posted by APWhite
              I use Visual Studio 2008 and I seem to have trouble with the subdirectories and the header files. z-info.c calls for #include "unit-test.h" but it is found in "tests/unit-test.h" and VS2008 can't seem to find it (even though it is in the project). I tried rewriting it to #include "Angband320/src/tests/unit-test.h" But it still fails. Anyone know how to get VS2008 to automatically scan the subdirectories or do I need to flatten all them out and move them in to the src directory?

              Andrew
              I'm using VS2010, not VS2008; but what I did should work for you.

              Firstly, you need to set the main source folder (not any of the sub-folders) as part of your include path. It should then automatically scan subdirectories when processing #include statements.

              Secondly, you need to set the properties of the player\types.c file so that it compiles to "p-util.obj" so that the linker doesn't get confused by having two files with the same name.

              I think that's all you need to do - but I haven't tried compiling a version that uses main-win.c or using SDL, since I compile it as a Windows Console app using my own main-wcn.c.
              Last edited by Dean Anderson; December 27, 2010, 11:15.

              Comment

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