Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old January 15, 2011, 17:28   #1
-K-
Rookie
 
Join Date: Jan 2011
Posts: 1
-K- is on a distinguished road
Issue with compile on Windows 7 64-bit using Visual C++ Express command line

Hi All,

I've decided to try learning to program this new year, I was taught some of the basics in school, but I must disclaim that I am still very much a newbie. There is an error I had when compiling Angband, and I was wondering if someone would be willing to help explain it to me.

Steps I took:
1. Downloaded and extracted the angband-3.2.0.tar.gz from rehial.org to my desktop.
2. Opened up Microsoft Visual C++ 2010 Express
3. Clicked on "Tools"->"Visual Studio Command Prompt"
4. Changed directory to angband-3.2.0\src\
5. Ran "nmake /f Makefile.nmake"

The error:

game-cmd.c
game-cmd.c(396) : error C2143: syntax error : missing ';' before 'type'
game-cmd.c(396) : error C2143: syntax error : missing ';' before 'type'
game-cmd.c(396) : error C2143: syntax error : missing ')' before 'type'
game-cmd.c(396) : error C2143: syntax error : missing ';' before 'type'
game-cmd.c(396) : error C2065: 'i' : undeclared identifier
game-cmd.c(396) : warning C4552: '<' : operator has no effect; expected operator
with side-effect
game-cmd.c(396) : error C2065: 'i' : undeclared identifier
game-cmd.c(396) : error C2059: syntax error : ')'
game-cmd.c(397) : error C2143: syntax error : missing ';' before '{'
game-cmd.c(398) : error C2065: 'i' : undeclared identifier
game-cmd.c(401) : error C2044: illegal continue
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

I took a look at line 396 in game-cmd.c and here is the code:

for (size_t i = 0; i < N_ELEMENTS(item_selector); i++)

I've found that I can get around the error if I comment out like so:

for (/*size_t */i = 0; i < N_ELEMENTS(item_selector); i++)

I also declare "i" as an integer at the beginning of the code.

Again, because I'm a newbie I really don't understand the code well enough to know if the fix I made is a good one, or just buggering things up further. Any help would be much appreciated.
-K- is offline   Reply With Quote
Old January 15, 2011, 21:28   #2
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by -K- View Post
I took a look at line 396 in game-cmd.c and here is the code:

for (size_t i = 0; i < N_ELEMENTS(item_selector); i++)

I've found that I can get around the error if I comment out like so:

for (/*size_t */i = 0; i < N_ELEMENTS(item_selector); i++)
Right.

MSVC implements C90 with a few extensions like long long, not C99. You can't declare a variable in a for loop in C90.

Quote:
Originally Posted by -K- View Post
I also declare "i" as an integer at the beginning of the code.
I'd declare i as size_t, although the signed/unsigned comparison warning from declaring i as int is harmless in this case.
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni 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
command line for loading an existing character Bilbo Vanilla 4 June 24, 2010 18:27
Is there a windows compile of Gumband 2.3.2 floating around? BlackFlame Variants 8 February 12, 2010 02:16
Visual Studio 2008 - building 32 & 64 bit now! LanceDiamond Development 5 April 25, 2009 14:59
[Un] Line endings - Windows or Unix? andrewdoull Variants 8 September 29, 2008 01:30
Getting Visual C++ 2008 Express Edition to compile Angband 3.0.9 Orillian Vanilla 5 February 10, 2008 10:23


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


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