Mail Archives: djgpp/1996/09/10/14:52:33
Scott Frazer wrote:
> aron AT wallaker DOT torolab DOT ibm DOT com (Aron Wallaker) wrote:
> >I'm having a problem trying to use #define's in a header file to define
> >constants for use in my C code. Here's an example:
> >--File:STAR.H---------------------
> >#define STARPOPULATION 0x200
> >--FILE:STAR.C---------------------
> >#include"star.h"
> >void main(void)
> >{
> > int LocalStarPop = STARPOPULATION; // This works.
> > for(x=0;x < STARPOPULATION ; x++) // This doesn't, see below.
> > {
> > //whatever
> > }
> >}
> Your filename "star.c" implies this is a C file, yet you are using
> C++ type comments. Are you using the C++ compiler (or is this
> just a theoretical example)? My second question would be what is
> 'x' defined as?
> Trying to help,
> Scott
Thanks Scott - this wasn't actual source, it was just a snapshot of my
source that I typed in while making the post. 'x' was probably defined as
an 'unsigned short'. The compiler in use is 'gcc', which I believe is the
Gnu 'C' compiler (? - I'm new to Gnu). In terms of the comments, I may
be using C++ style comments in my code, it's a lazy habit, but in the actual
code I wouldn't have commented the "for(..." statement anyways so assume
that there was no comment on the same line as the "for(..." to confuse the
parser.
If I get time I will boild down my source & header files to the smallest
example with the same error and post the source, header & make files
tomorrow.
Thanks,
-Aron
--
Aron Wallaker IBM Microelectronics Development Lab
wallaker AT vnet DOT ibm DOT com Toronto, Ontario
These are my opinions-IBM has its own
- Raw text -