Mail Archives: djgpp/1996/09/10/11:42:24
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
}
}
When I try to set a local variable to the value I have #define'd in the
header file, it seems to work fine. However, if I try to use the #define
value in a function call, or a structure such as the for(... above, I
get a "parsing error in line...." error. I checked the FAQ's I could find,
and I saw no mention of this behavior. I have DJGPP V2.0 which I dl'd off
simtel about 2 weeks back. Does this look familiar to anyone ? I use this
type of #define all the time in Watcom, so I'd be pretty dissapointed if
I couldn't do something similar under DJGPP. I tried searching for any
command-line parameters which might affect the preprocessor and how it
handles #define's but I didn't find any. I would appreciate any feedback
anyone could give me.
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 -