Article View: gnu.g++.bug
Article #1257gcc error (?) with templates.
From: Kilitzirakis christos 122
Date: Mon, 14 Dec 1992 09:22
Date: Mon, 14 Dec 1992 09:22
68 lines
2497 bytes
2497 bytes
WARNING:
THIS IS MY FIRST REPORT, SO BE PATIENT.
--------------------------------
VERSION :
C18 % gcc -v
ld.so: warning: /usr/lib/libc.so.1.6 has older revision than expected 7
Reading specs from /usr/local/lib/gnu/gcc-lib/sparc-sun-sunos4.1.2/2.3.1/specs
gcc version 2.3.1
/usr/local/lib/gnu/gcc-lib/sparc-sun-sunos4.1.2/2.3.1/ld -e start -dc -dp /lib/crt0.o -L/usr/local/lib/gnu/gcc-lib/sparc-sun-sunos4.1.2/2.3.1 -L/usr/local/lib/gnu -lm -lg++ -lgcc -lc -lgcc
ld.so: warning: /usr/lib/libc.so.1.6 has older revision than expected 7
ld: Undefined symbol
_main
collect: /usr/bin/ld returned 2 exit status
--------------------------------------
DESCRIPTION OF ERROR :
listing :
template <class T>
void At(T r,T &ret) {
if (r.size != ret.size)
cout <<" A-1 wrong args";
T temp(r.size);
for (int i=0;i<r.size;i++)
temp.p[i] = r.p[i];
for (i=1;i<r.size;i++)
ret.p[i] = ret.p[r.size-i];
}
............
class cm {
double *p,int size;
.........
};
cm & cm::operator/=(cm &r) {
At(*this,r);
return *this;
}
...............................
class bcm {
cm *p;
int size;
........
};
bcm& bcm::operator/=(bcm &r) {
At(*this,r);
return *this;
}
compiling output ::
20 % g circle
ld.so: warning: /usr/lib/libc.so.1.6 has older revision than expected 7
ld.so: warning: /usr/lib/libc.so.1.6 has older revision than expected 7
ld.so: warning: /usr/lib/libc.so.1.6 has older revision than expected 7
as: "/usr/tmp/cca25410.s", line 2023: error: redefinition of symbol "_At"
----------------------------------------
COMMENTS:
1.All operators needed by template function, are either defined, or
or the objects are type double.
2.If I comment either of two calls , the compiler does not errors.
----------------------------------------
You can reach me, at
kilitzir@ics.forth.gr
before Friday , for any questions or answers !
Happy Xmas
XXRistos
Technical Details
Message-ID:
<1992Dec14.092253.25515@csd.uch.gr>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!csd.uch.gr!kilitzirShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!csd.uch.gr!kilitzir From: kilitzir@csd.uch.gr (Kilitzirakis christos 122) Subject: gcc error (?) with templates. Message-ID: <1992Dec14.092253.25515@csd.uch.gr> Summary: gcc reports an error in a compile-free(?) source Keywords: gcc,error,templates Sender: gnulists@ai.mit.edu Organization: Computer Science Department, University of Crete HELLAS Distribution: gnu Date: Mon, 14 Dec 1992 09:22:53 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 73