![]() |
#1 |
Adept
Join Date: Jul 2007
Location: St George Utah, USA
Posts: 244
![]() |
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]; 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 |
![]() |
![]() |
![]() |
#2 |
Rookie
Join Date: Jun 2007
Location: Bristol, UK
Posts: 23
![]() |
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 08:52. |
![]() |
![]() |
![]() |
#3 |
Veteran
Join Date: Apr 2007
Posts: 1,947
Donated: $40
![]() |
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- |
![]() |
![]() |
![]() |
#4 |
Adept
Join Date: Nov 2009
Posts: 166
![]() |
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro Problem | Larvitz | Vanilla | 6 | January 21, 2009 20:59 |
Quickband Problem | The Sparrow | Variants | 5 | January 15, 2009 19:44 |
Odd Problem | The Sparrow | Vanilla | 1 | December 27, 2008 23:11 |
Macro Problem? | cerberus | Vanilla | 3 | October 8, 2008 09:45 |
Macro problem | Zero | Vanilla | 2 | June 20, 2008 14:52 |