Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old February 21, 2009, 20:45   #1
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Compling with Dev-C++

Instructions from rephail, comments in italic.

"invalid conversion from 'void*' to 'char*' (line 132 in *string_make in z-virt.c)
Code:
124:	char *res;
/*... skip some lines ...*/
130:	/* Allocate space for the string (including terminator) */
131:	siz = strlen(str) + 1;
132:	res = mem_alloc(siz);
mem_alloc is defined in the same z-virt.c as
Code:
void *mem_alloc(size_t len)
If I add a (char *) it compiles (hopefully that's correct).
Code:
	res = (char *)mem_alloc(siz);
Same on line 148 same file.

birth.c (and I guess other files) have a lot of these as well.

I think they were reported as warnings by VC++ rather than errors (Dev-C++).

[EDIT]The birth.c 'errors' are trickier and I can't change the file to get Dev-C++ to accept it.

Last edited by PaulBlay; February 21, 2009 at 20:59.
PaulBlay is offline   Reply With Quote
Old February 21, 2009, 23:24   #2
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by PaulBlay View Post
Instructions from rephail, comments in italic.

"invalid conversion from 'void*' to 'char*' (line 132 in *string_make in z-virt.c)
Code:
124:	char *res;
/*... skip some lines ...*/
130:	/* Allocate space for the string (including terminator) */
131:	siz = strlen(str) + 1;
132:	res = mem_alloc(siz);
mem_alloc is defined in the same z-virt.c as
Code:
void *mem_alloc(size_t len)
If I add a (char *) it compiles (hopefully that's correct).
Code:
	res = (char *)mem_alloc(siz);
Same on line 148 same file.

birth.c (and I guess other files) have a lot of these as well.

I think they were reported as warnings by VC++ rather than errors (Dev-C++).

[EDIT]The birth.c 'errors' are trickier and I can't change the file to get Dev-C++ to accept it.
I think you're trying to compile Angband as a C++ application, since all of this is perfectly valid C.
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old February 22, 2009, 00:37   #3
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,367
AnonymousHero is on a distinguished road
Yeah, in C the general consensus seems to be to to not cast from malloc (or equivalent).
AnonymousHero is offline   Reply With Quote
Old February 22, 2009, 11:46   #4
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Windows + Dev-C++ (4.9.9.2)

1. Get and install DevC++.

2. Create a new project. Select "Empty Project" and "C project" from the dialog and put it in the source directory (you can place it elsewhere but you may need to fiddle about a bit more if you do).

3. Add every C file in src\, except for the main*.c files. Then add main-win.c.

4. Add all C files from the sub folders 'monster', 'object', 'player' and 'win' (could be placed in project subfolders to look neater but work if all added to the main list anyway).

5. Add 'angband.rc' to the project from 'win'.

6. Go to Project -> Project Options, and:
1) In the "General" tab, ensure "Win32 console" is selected as type.
2) Click on "Browse" under "Icon" and select angband.ico.
3) In the "Build Options" tab, change the executable output directory to "..\".
4) In the "Compiler" tab ensure "Support all ANSI standard C Programs" and "Attempt to support some aspects of traditional C programs" are set to 'No'.

7. In the "parameters" tab, add:
1) -mwindows -DWINDOWS -I. to the compiler options.
2) -lmingw32 -lwinmm -mwindows to the linker options.

8. Compile.

[EDIT] Instructions at official site have now been updated.

Last edited by PaulBlay; February 23, 2009 at 11:16. Reason: main.c not required, right?
PaulBlay is offline   Reply With Quote
Old February 22, 2009, 14:18   #5
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Alternative version.

This requires the Dev-C++ project file (Angband.dev), but saves a lot of steps.

Windows + Dev-C++ (4.9.9.2)

1. Get, install and run DevC++.

2. Open 'Angband.dev' in the src\ directory.

3. Compile.

I think it should just work like that - if anyone wants the 'angband.dev' file to check, PM me.

Last edited by PaulBlay; February 22, 2009 at 15:40.
PaulBlay is offline   Reply With Quote
Old December 14, 2009, 20:08   #6
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
I tried compiling Angband with DevC++ , first I tried the instructions on the website http://rephial.org/wiki/Compiling#s2_4 then I tried PaulBlay's instructions in this thread (which are slightly different) and both times I got
[build error] [attack.o] Error 1
(This is the source of v3.1.1.1626 downloaded from http://rephial.org/)

(Not that important to me since I downloaded the code mainly to look at it, not to compile it, but you might want to keep the instructions on the website accurate)
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher is offline   Reply With Quote
Old December 15, 2009, 23:32   #7
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
Just got exactly the same result trying to compile FAangband. I used the windows port options (because I'm using windows) but not the SDL options. (I dont' know what SDL is, so I don't think I need it..?)
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dev Bug rdermyer Vanilla 13 December 24, 2008 03:49
V dev bugs Pete Mack Vanilla 5 September 22, 2008 01:38
Merge in 3.0.9e changes with dev. Irashtar Vanilla 22 September 18, 2008 20:01
[Dev] major Fear bug. Irashtar Vanilla 1 August 31, 2008 04:03
Ironband dev question Antoine Variants 1 January 11, 2008 06:10


All times are GMT +1. The time now is 18:02.


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