delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/26/15:01:17

Message-Id: <m0zBklW-000S4xC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
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
Subject: Re: Problem with include-files
In-reply-to: <35e443c2.92340@news.space.net>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019