Path: utzoo!utgpu!watserv1!watmath!att!occrsh!uokmax!apple!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!jarthur!uci-ics!rfg From: rfg@ics.uci.edu (Ronald Guilmette) Newsgroups: comp.lang.c++ Subject: Re: extern const definition Keywords: extern const Message-ID: <26698F07.9498@paris.ics.uci.edu> Date: 3 Jun 90 22:28:23 GMT References: <612@atcmpe.atcmp.nl> Reply-To: rfg@ics.uci.edu (Ronald Guilmette) Organization: UC Irvine Department of ICS Lines: 32 In article <612@atcmpe.atcmp.nl> leo@atcmp.nl (Leo Willems) writes: > >This C++ code compiles under 1.2, 2.0 (both Glockenspiel) and Zortech (2.06): > > extern const int eof = -1; > >The C generating cfront compilers both emit multiple definitions for eof >from which the c compiler gets a headache. I must assume that you had the statement shown above in an include file which was included more than once into the various base files that make up your complete program. That's the problem. You can only have one "defining occurance" of a data object with storage class "extern" in your whole program. >Who is wrong? Is there a fix? You are. Fix your code. >Another, related question: > >Must ANSI C compilers accept this: > > int eof = -1; > int eof = -1; Nope. They must not. // Ron Guilmette (rfg@ics.uci.edu) // C++ Entomologist // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.