delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/11/16/18:42:05

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <4.1.19991116152035.00aa6060@clea.qualcomm.com>
X-Sender: cemani AT clea DOT qualcomm DOT com
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.1
Date: Tue, 16 Nov 1999 15:40:29 -0800
To: cygwin AT sourceware DOT cygnus DOT com
From: "Chalapathi R. Emani" <cemani AT qualcomm DOT com>
Subject: Linking problems with templates.
In-Reply-To: <Pine.HPP.3.96.991116165245.11509L-100000@hp2.xraylith.wisc
.edu>
References: <4 DOT 1 DOT 19991116144918 DOT 00aa3e60 AT clea DOT qualcomm DOT com>
Mime-Version: 1.0

Hi,

I am trying to use the latest version from  cygwin and 
I am having linking problems with a file that uses templates:

When I compiled one of the source  file I got the following warnings:

Config.h:178: warning: friend declaration `class istream & operator >>(class
ream &, class OrderedTriple<T> &)'
Config.h:178: warning:   declares a non-template function
Config.h:178: warning:   (if this is not what you intended, make sure
Config.h:178: warning:   the function template has already been declared,
Config.h:178: warning:   and add <> after the function name here)
Config.h:179: warning: friend declaration `class ostream & operator
<<(class ost
ream &, class OrderedTriple<T> &)'
Config.h:179: warning:   declares a non-template function
Config.h:231: warning: friend declaration `class istream & operator
>>(class ist
ream &, class OrderedPair<T> &)'
Config.h:231: warning:   declares a non-template function
Config.h:232: warning: friend declaration `class ostream & operator
<<(class ost
ream &, class OrderedPair<T> &)'
Config.h:232: warning:   declares a non-template function

When I linked this file to libstdc++.a I got linker errors that said:

/examples/scs_sid/Config.cxx:29: undefined reference to `operator>>(istream &
rderedPair<int> &)'
/examples/scs_sid/Config.cxx:29: undefined reference to `operator>>(istream &
rderedPair<double> &)'
/examples/scs_sid/Config.cxx:29: undefined reference to `operator>>(istream &
rderedTriple<int> &)'


These have been defined in the header file itself.

I went ahead and compiled this with the flag "-fguiding-decls"   and these
warnings have gone away.
Then I tried linking this with the rest of the objects and libstdc++.a and
I am getting the following 
errors:

C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2
.91.
57\..\..\../libstdc++.a(ldcomplex.o)(.text+0x13c):cinst.cc: multiple definition
of `operator/(complex<long double> const &, long double)'
Config.o(.text$__dv__FRCt7complex1Zrr+0x0):/examples/scs_sid/\\cygnus\\cygwi
n-b2
0\\H-i586-cygwin32\\lib\\gcc-lib\\i586-cygwin32\\egcs-2.91.57\\..\\..\\..\\.
.\\.
.\\include\\g++\\stl_list.h: first defined here
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2
.91.
57\..\..\../libstdc++.a(dcomplex.o)(.text+0x128):cinst.cc: multiple
definition o
f `operator/(complex<double> const &, double)'
Config.o(.text$__dv__FRCt7complex1Zdd+0x0):/examples/scs_sid/\\cygnus\\cygwi
n-b2
0\\H-i586-cygwin32\\lib\\gcc-lib\\i586-cygwin32\\egcs-2.91.57\\..\\..\\..\\.
.\\.
.\\include\\g++\\stl_list.h: first defined here
C:\cygnus\cygwin-b20\H-i586-cygwin32\bin\..\lib\gcc-lib\i586-cygwin32\egcs-2
.91.
57\..\..\../libstdc++.a(fcomplex.o)(.text+0xf8):cinst.cc: multiple
definition of
 `operator/(complex<float> const &, float)'
Config.o(.text$__dv__FRCt7complex1Zff+0x0):/examples/scs_sid/\\cygnus\\cygwi
n-b2
0\\H-i586-cygwin32\\lib\\gcc-lib\\i586-cygwin32\\egcs-2.91.57\\..\\..\\..\\.
.\\.
.\\include\\g++\\stl_list.h: first defined here
collect2: ld returned 1 exit status


The problem is that I am not seeing the reference to "operator/ ...."
anywhere either in my code
or in stl-list.h  or any other header files. But somehow the linker keeps
saying that there are
multiple definitions.


On Solaris when I use the "-fguiding-decls"  option  and compile and link
it, it builds just fine.
May be because I use 2.8.1 on Solaris.

Do you know if the above option has been deprecated in   Cygwin 2.95.2  ?


Thanks a lot for your help.

Chalapathi.







--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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