delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/20/00:06:57

From: "Ron Grunwald" <RGRUNWAL AT wasp DOT cs DOT cowan DOT edu DOT au>
Organization: Edith Cowan University
To: djgpp AT sun DOT soe DOT clarkson DOT edu, 96kfd AT williams DOT edu (der tanzende Tigger)
Date: Mon, 20 Nov 1995 11:51:25 GMT+800
Subject: Re: multiply defined methods in djgpp g++
Reply-To: r DOT grunwald AT cowan DOT edu DOT au

The Dancing Tiger wrote:

> I am doing some cross-platform compiling with gcc 2.7.0 (SunOS) and
> gcc 2.6.3 (djgpp 1.12). The object files compile without any errors on
> both, and the Sun program links and runs. When djgpp gets to
> 
> it gives streams of error messages that look like
> 
> obsdb.cc(.text+0xb6): multiple definition of `Observatory::DST(void)'
> gof.cc(.text+0xb6): first defined here

> This never shows up under SunOS and all it does is
> compile the 13 object files and then link, nothing fancy. Any ideas?

Usually, these kind of error messages mean what they say. Have you 
checked OBSDB.CC and GOF.CC to see whether they both do contain a 
definition of that member function?

Djgpp's GCC and Borland's BCC both won't compile when multiple defs. 
of a single func. exists. I suspect SunOS's compiler is a bit more 
lenient in regards to this.

To overcome the problem you would have to use precompilation 
constructs such as:

#ifndef  _INCL_OBSDB_CC
#define  _INCL_OBSDB_CC

<member func. definition>
#endif

for file "obsdb.cc", and for "gof.cc" have:

#ifndef _INCL_OBSDB_CC

<member func. definition>
#endif


This should prevent multiple definitions, and hence successful 
compilation. Hope this helps.


Regards, Ron.


 ********************************************************************
 | Author.............. Ron Grunwald                                | 
 | Internet............ r DOT grunwald AT cowan DOT edu DOT au                     |
 | Phone............... (09)273 8027 or (09)273 8468                |
 |------------------------------------------------------------------|
 | Department.......... Computer Operations and Systems Management  |
 | Division/Faculty.... Information Technology                      | 
 | Institute........... Edith Cowan University, Churchlands         | 
 | Location............ Perth, Western Australia                    |
 ********************************************************************
 "I don't have any solution but I certainly admire the problem!"


- Raw text -


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