Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old December 25, 2010, 06:33   #1
APWhite
Adept
 
APWhite's Avatar
 
Join Date: Jul 2007
Location: St George Utah, USA
Posts: 244
APWhite is on a distinguished road
3.2 problem with process_command()

Looks like VS2008 is getting even more picky these days.

Code:
void process_command(cmd_context ctx, bool no_request)
{
	game_command *cmd;

	/* Reset so that when selecting items, we look in the default location */
	p_ptr->command_wrk = 0;

	/* If we've got a command to process, do it. */
	if (cmd_get(ctx, &cmd, !no_request) == 0)
	{
		int oldrepeats = cmd->nrepeats;
		int idx = cmd_idx(cmd->command);

		if (idx == -1) return;

		for (size_t i = 0; i < N_ELEMENTS(item_selector); i++)
		{
			struct item_selector *is = &item_selector[i];
Is yeilding the following errors:
Code:
.\src\game-cmd.c(396) : error C2143: syntax error : missing ';' before 'type'
.\src\game-cmd.c(396) : error C2143: syntax error : missing ';' before 'type'
.\src\game-cmd.c(396) : error C2143: syntax error : missing ')' before 'type'
.\src\game-cmd.c(396) : error C2143: syntax error : missing ';' before 'type'
.\src\game-cmd.c(396) : error C2065: 'i' : undeclared identifier
.\src\game-cmd.c(396) : warning C4552: '<' : operator has no effect; expected operator with side-effect
.\src\game-cmd.c(396) : error C2065: 'i' : undeclared identifier
.\src\game-cmd.c(396) : error C2059: syntax error : ')'
.\src\game-cmd.c(397) : error C2143: syntax error : missing ';' before '{'
.\src\game-cmd.c(398) : error C2065: 'i' : undeclared identifier
.\src\game-cmd.c(401) : error C2044: illegal continue
Looks like my config of VS2008 does like the size_t.
APWhite is offline   Reply With Quote
Old December 25, 2010, 09:01   #2
Omnipact
Rookie
 
Join Date: Jun 2007
Location: Bristol, UK
Posts: 23
Omnipact is on a distinguished road
This line is where my compile originally failed.
GCC was helpful in saying to put the switch '-std=c99' in.

Maybe VS is in c89 mode? You may need to find the 'my code is c99' checkbutton/switch.

EDIT: A quick google shows that Visual Studio does not support c99 and m$ aren't very interested in it for the future either.
One suggestion I seen is renaming the file to '.cpp' to allow initialisation inside a loop.



Iain

Last edited by Omnipact; December 25, 2010 at 09:52.
Omnipact is offline   Reply With Quote
Old December 25, 2010, 11:13   #3
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
I'm sorry about that, I'm not sure how I wasn't get warnings about it-- I thought I had the right ones turned on.

Try just moving size_t out of the for statement:

Code:
void process_command(cmd_context ctx, bool no_request)
{
	game_command *cmd;

	/* Reset so that when selecting items, we look in the default location */
	p_ptr->command_wrk = 0;

	/* If we've got a command to process, do it. */
	if (cmd_get(ctx, &cmd, !no_request) == 0)
	{
		int oldrepeats = cmd->nrepeats;
		int idx = cmd_idx(cmd->command);
		size_t i;

		if (idx == -1) return;

		for (i = 0; i < N_ELEMENTS(item_selector); i++)
		{
			struct item_selector *is = &item_selector[i];
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old December 26, 2010, 18:57   #4
Dean Anderson
Adept
 
Join Date: Nov 2009
Posts: 128
Dean Anderson is on a distinguished road
Quote:
Originally Posted by takkaria View Post
Try just moving size_t out of the for statement:
That's what I've been having to do to get it to compile under VS2010.
Dean Anderson is offline   Reply With Quote
Old December 26, 2010, 19:32   #5
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 39
Posts: 1,516
d_m is on a distinguished road
This size_t declaration is fixed in staging--that fix should soon go to master.
__________________
linux->xterm->screen->pmacs
d_m 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
Macro Problem Larvitz Vanilla 6 January 21, 2009 21:59
Quickband Problem The Sparrow Variants 5 January 15, 2009 20:44
Odd Problem The Sparrow Vanilla 1 December 28, 2008 00:11
Macro Problem? cerberus Vanilla 3 October 8, 2008 10:45
Macro problem Zero Vanilla 2 June 20, 2008 15:52


All times are GMT +1. The time now is 23:48.


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