Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!mcsun!hp4nl!kunivv1!atcmpe!leo From: leo@atcmp.nl (Leo Willems) Newsgroups: comp.lang.c++ Subject: Re: extern const definition Message-ID: <615@atcmpe.atcmp.nl> Date: 5 Jun 90 20:52:55 GMT References: <240@taumet.COM> Organization: AT Computing, Nijmegen, The Netherlands Lines: 26 From article <240@taumet.COM>, by steve@taumet.COM (Stephen Clamage): > 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. > > You should use > extern const int eof = -1; > in exactly one place, and > extern const int eof; > everywhere else. This way you have exactly one defining instance. Yes, thank you, that works. What I did (wrong?) was to include the #include-file with the external declaration into the file where the actual initialisation is done. This seemed the right way to do :-( Leo Willems Internet: leo@atcmp.nl AT Computing UUCP: mcsun!hp4nl!kunivv1!atcmpe!leo P. O. Box 1428 6501 BK Nijmegen Phone: +31-80-566880 The Netherlands Fax: +31-80-555887