Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Development (http://angband.oook.cz/forum/forumdisplay.php?f=10)
-   -   Compiling 3.2 (http://angband.oook.cz/forum/showthread.php?t=3974)

Omnipact December 24, 2010 21:11

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 December 24, 2010 21:43

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.

Omnipact December 24, 2010 21:51

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...

takkaria December 25, 2010 03:50

Quote:

Originally Posted by Omnipact (Post 45528)
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.

APWhite December 25, 2010 05:59

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

Omnipact December 25, 2010 09:15

Quote:

Originally Posted by APWhite (Post 45553)
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

Dean Anderson December 27, 2010 10:39

Quote:

Originally Posted by APWhite (Post 45553)
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.


All times are GMT +1. The time now is 03:38.

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