Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: califax AT wupperonline DOT de (Klaus Petzold), djgpp AT delorie DOT com Date: Wed, 26 Aug 1998 15:59:09 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Problem with include-files In-reply-to: <35e443c2.92340@news.space.net> Precedence: bulk califax AT wupperonline DOT de (Klaus Petzold) wrote: > I have a problem under DJGPP version 2.7.2.1 when I want to implement > something like the following: > > ->filename: test.h > > #ifndef _TEST_ > #define _TEST_ > > int t; > > #endif > > ->filename test.cc > > #include "test.h" > > > -> filename main.cc > > #include "test.h" > > int main() > { > } > > When I link these files I get the following error message: > -multiple definition of 't' > What's wrong? You are using C++ and giving 2 weak references to t and no strong definition so 2 are defined try it: > ->filename: test.h > > #ifndef _TEST_ > #define _TEST_ > extern int t; > > #endif > > ->filename test.cc > > #include "test.h" > > > -> filename main.cc > > #include "test.h" int t; > int main() > { > } SET ------------------------------------ 0 -------------------------------- Visit my home page: http://set-soft.home.ml.org/ or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013