Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Compiling Error

Author: Stefano Gemma

Date: 06:28:57 07/19/04

Go up one level in this thread


On July 18, 2004 at 07:36:02, Daniel Clausen wrote:

>On July 18, 2004 at 05:52:53, Stefano Gemma wrote:
>
>>On July 18, 2004 at 01:34:49, Nolan Denson wrote:
>>
>>>While compiling crafty i get the following error. Does anyone know how to fix
>>>this problem.
>>>
>>>C:\Program Files\Microsoft Visual Studio\MyProjects\Crafty\chess.h(999): error:
>>>variable "leftrnd" has already been initialized
>>>  static int      leftrnd = -1;      // can *next++ this many times before
>>[...]
>>
>>I don't know Crafty sources, but i think that you can change chess.h this way:
>>
>>static int      leftrnd;
>>
>>and then put in chess.c (or in just one another .c file that include chess.h)
>>the line:
>>
>>static int      leftrnd = -1;
>>
>>Ciao!!!
>>
>>Stefano Gemma
>
>I'm not quite sure I understand the whole thing here. Firstly, statics in a
>headerfile? That's... interesting. :) Since this 'leftrnd' thing seems to be
>used in multiple .c files (otherwise there's no reason to put it in a .h file),
>it should be declared as 'extern' in the headerfile. That or I miss something
>fundamentally here.

That's just what i've suggested: to put away from header file the definition of
leftrnd. Maybe i've forget the "extern" keyword. I'm wondering how could Crafty
have such kind of error, maybe some compiler does'nt report it?

Ciao!!!

Stefano Gemma



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.