Mail Archives: djgpp/1998/08/26/15:01:17
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 -