Xref: news2.mv.net comp.os.msdos.djgpp:8480 From: aron AT wallaker DOT torolab DOT ibm DOT com (Aron Wallaker) Newsgroups: comp.os.msdos.djgpp Subject: Re: Problem with #define's under DJGPP Date: 9 Sep 1996 20:16:03 GMT Organization: IBM Microelectronics Division Lines: 52 Message-ID: <511tu3$gmo@tornews.torolab.ibm.com> References: <511bnh$nne AT tornews DOT torolab DOT ibm DOT com> <511jai$rjt AT cnn DOT exu DOT ericsson DOT se> Reply-To: wallaker AT vnet DOT ibm DOT com NNTP-Posting-Host: wallaker.torolab.ibm.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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