Article View: gnu.g++.bug
Article #1270friend inline functions in 2.3.2
From: Bradley D. Keister
Date: Tue, 15 Dec 1992 09:29
Date: Tue, 15 Dec 1992 09:29
69 lines
1630 bytes
1630 bytes
I'm getting the following error messages at link time which involve an
inline friend function under g++ 2.3.2 on a SPARC and an HP:
2.3.2 on a SPARC:
% g++ -o friend friend.c
ld: Undefined symbol
_get_a__FR1A
collect: /usr/bin/ld returned 2 exit status
2.3.2 on an HP 730:
g++ -o friend friend.c
ld: Unsatisfied symbols:
get_a__FR1A (code)
collect: /bin/ld returned 1 exit status
// --------------------------
This code runs fine on a DECstation or SPARC running g++ 2.2.2 or a
DECstation running cfront 3.0.
Brad Keister
Department of Physics
Carnegie Mellon University
Pittsburgh, PA 15213
(412) 268-2772 (office)
(412) 681-0648 (FAX)
internet: keister@poincare.phys.cmu.edu
BITNET: keister%poincare.phys.cmu.edu@CARNEGIE
// --------------------------
// file "friend.h"
#ifndef FRIENDH
#define FRIENDH
class A {
protected:
int a;
public:
A(int aa) {a = aa;}
~A() {}
friend int get_a(A& x) {return x.a;}
};
#endif
// --------------------------
// file "friend.c"
#include <stdio.h>
#include "friend.h"
main()
{
A Atest(5);
printf("a: %3d\n", get_a(Atest));
return 0;
}
// --------------------------
Technical Details
Message-ID:
<9212151929.AA16049@poincare.phys.cmu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!poincare.phys.cmu.edu!keisterShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!poincare.phys.cmu.edu!keister From: keister@poincare.phys.cmu.edu (Bradley D. Keister) Subject: friend inline functions in 2.3.2 Message-ID: <9212151929.AA16049@poincare.phys.cmu.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 15 Dec 1992 09:29:43 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 71