Date: Thu, 13 Mar 1997 19:17:08 -0700 (MST) From: David May To: Paul Peavyhouse cc: djgpp AT delorie DOT com Subject: Re: DJGPP inconsistencies? In-Reply-To: <5g9pat$fac@netra.montana.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 13 Mar 1997, Paul Peavyhouse wrote: > if ( (str = getenv("DEM_PATH")) == NULL) { > printf("'DEM_PATH' environment variable not set\n"); > exit(1); > } > BITMAP *buffer; <-- Parse error on THIS line > > If I move BITMAP *buffer before the "if" statement, the compiler is > all happy...WHY? Thanks anyway for the reply. > > PV Because this is C, not C++. I suggest you get the C FAQ and read it. It will tell you what is ANSI C, not C compiler extensions. If you meant to compile C++, you should rename the extension to .cc (or on the command line, tell gcc to compile it as a .C - capital C - file). On reading what I just wrote, I can see that it is not real clear. I'm assuming that you mean to write C code, but are used to Borland C++, where the compiler is set to compile C++ always, or have a compiler that allows you to declare variables anywhere in the code that C++ would allow. Allowing facilities that are not part ANSI are called extensions to the language. gcc determines how it will compile the source based on the file extension. A program with an extension of .c is a C program; one with an extension of .cc, .cpp, .cxx, or .C is considered a C++ program. Hope this helps. David May ID Card Administrator Albuquerque TVI