🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.migration
Article #25

Re: BCB4 to BCB6

#25
From: Ed Mulroy
Date: Thu, 18 Aug 2005 22:20
35 lines
2350 bytes
> [Linker Warning] Public symbol '_DATEN' defined in both module
>  D:\...\unit6.obj and in D:\...\unit4.obj
>
> but DATEN is a global variable defined in
> unit1.cpp only - e.g. unsigned short DATEN;

The error suggests that DATEN is declared in a header file.  The leading 
underscore is a consequence of how public names are formed for variables in 
C and C++.

The preprocessor merges included files into the source and presents the 
merged result to the compiler.  When the linker phase begins it sees a 
same-name symbol from each object file which included the header file.

The solution is not difficult or exotic - it's been the same since the days 
of K&R C.  Declare the variable with the keyword extern in the header file 
and then put the real declaration in one and only one source file.

.  Ed

> Sam wrote in message
> news:4304e616$1@newsgroups.borland.com...
>
> Thanks Ed for the tip.
> Now it works fine, but there are now some strange
> Linker warnings after build project.
>
> here is one example:
> ...
> [Linker Warning] Public symbol '_DATEN' defined in both module
>  D:\...\unit6.obj and in D:\...\unit4.obj
> ...
>
> but DATEN is a global variable defined in
> unit1.cpp only - e.g. unsigned short DATEN;
Technical Details
Message-ID: <430509d7@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!nx01.iad01.newshosting.com!newshosting.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4301e9e2$1@newsgroups.borland.com> <43021847$1@newsgroups.borland.com> <4304e616$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 110f51,f1c3cc2d5751115
X-Google-Attributes: gid110f51,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.migration
References: <4301e9e2$1@newsgroups.borland.com> <43021847$1@newsgroups.borland.com> <4304e616$1@newsgroups.borland.com>
Subject: Re: BCB4 to BCB6
Date: Thu, 18 Aug 2005 18:20:24 -0400
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 69.134.170.196
Message-ID: <430509d7@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1124403671 69.134.170.196 (18 Aug 2005 15:21:11 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!nx01.iad01.newshosting.com!newshosting.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail