Article View: gnu.gcc.help
Article #862Undefined symbol from g++ during load
From: Galt Johnson
Date: Sat, 23 Jan 1993 00:31
Date: Sat, 23 Jan 1993 00:31
41 lines
1385 bytes
1385 bytes
The gnu c++ compiler version 2.3.3 doesn't seem to be emitting code for the template
operator<< routine. When I issue the command:
g++ test.cc
I get the following complaint from the loader:
ld: Undefined symbol
___ls__FR7ostreamRt4Test1Zi
collect: /usr/bin/ld returned 2 exit status
Is there a compiler switch I'm missing?
I'm using gcc-2.3.3 on a SPARCstation(SunOS 4.1).
Galt Johnson
johnson@redbrick.com
----------------------------------------------------------------------
#include <iostream.h>
template <class T> class Test{
public:
Test(T i) : val(i) {}
friend ostream& operator<<(ostream &s, Test<T>& t);
private:
T val;
};
template <class T>
ostream& operator<<(ostream& s, Test<T> &h)
{
s << h.val;
return s;
};
main()
{
Test<int> i(3);
cout << "This is a test :" << i << endl;
}
----------------------------------------------------------------------
Technical Details
Message-ID:
<9301230030.AA25728@teeny.redbrick.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!teeny.redbrick.com!johnsonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!teeny.redbrick.com!johnson From: johnson@teeny.redbrick.com (Galt Johnson) Newsgroups: gnu.gcc.help Subject: Undefined symbol from g++ during load Date: 22 Jan 1993 19:31:38 -0500 Organization: GNUs Not Usenet Lines: 41 Sender: daemon@cis.ohio-state.edu Distribution: gnu Message-ID: <9301230030.AA25728@teeny.redbrick.com>