Thread View: gnu.gcc.help
1 messages
1 total messages
Started by Galt Johnson
Sat, 23 Jan 1993 00:31
Undefined symbol from g++ during load
Author: 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;
}
----------------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads