Thread View: gnu.g++.help
1 messages
1 total messages
Started by Hans Juergen Thoennissen
Tue, 08 Sep 1992 11:57
linking template classes
Author: Hans Juergen Thoennissen
Date: Tue, 08 Sep 1992 11:57
Date: Tue, 08 Sep 1992 11:57
53 lines
1469 bytes
1469 bytes
Hello,
this is my first posting in the usenet so please sorry for choosing the wrong groups ..... but I need help !!!
I have a problem with the GNU C++ V2.1 Compiler on my SPARCstation SLC, using sunos4.1.1 !!!
The problem is the following:
FILE1: foo_test.cc
#include "foo.h"
main() {
Array<int> ALF;
}
FILE2: foo.h
template <class Typ>
class Array {
public: Array() {Init();}
private: void Init();
};
FILE3: foo.cc
#include "foo.h"
template <class Typ> void
Array<Typ>::Init() {
}
COMMANDS:
g++ -c foo.cc
g++ foo_test.cc foo.o
This results in the following linker error:
ld: Undifined symbol
_Init__t5Array1Zi
collect: /usr/bin/ld returned 2 exit status
But if I put all 3 files in one, it works.
It seems, that the linker has a problem with the template class.
Can anybody explain what I am doing wrong or if something is not
installed correctly.
Thanks in advance
Hans-Juergen
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