This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Help with templates
- From: Ricardo Santos <rs at isctem dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 12 Aug 2004 18:15:36 +0200
- Subject: Help with templates
I have a problem with templates.
I am doing a little class (Stack) to demonstrate templates, and I have a
library problem.
I don't know wich library I have to compile with, to use templates...
My compilation line is:
g++ -o s StackAr.cpp mStackAr.cpp
And the Result of that command is:
/home/rs/tmp/cc0KjPdZ.o(.text+0x1c): In function `main':
: undefined reference to `StackAr<int>::StackAr[in-charge]()'
/home/rs/tmp/cc0KjPdZ.o(.text+0x36): In function `main':
: undefined reference to `StackAr<int>::Push(int const&)'
/home/rs/tmp/cc0KjPdZ.o(.text+0x50): In function `main':
: undefined reference to `StackAr<int>::Push(int const&)'
/home/rs/tmp/cc0KjPdZ.o(.text+0x6a): In function `main':
: undefined reference to `StackAr<int>::Push(int const&)'
/home/rs/tmp/cc0KjPdZ.o(.text+0x84): In function `main':
: undefined reference to `StackAr<int>::Pop()'
/home/rs/tmp/cc0KjPdZ.o(.text+0xb6): In function `main':
: undefined reference to `StackAr<int>::Top() const'
/home/rs/tmp/cc0KjPdZ.o(.text+0xe8): In function `main':
: undefined reference to `StackAr<int>::Pop()'
/home/rs/tmp/cc0KjPdZ.o(.text+0x10f): In function `main':
: undefined reference to `StackAr<int>::~StackAr [in-charge]()'
/home/rs/tmp/cc0KjPdZ.o(.text+0x12d): In function `main':
: undefined reference to `StackAr<int>::~StackAr [in-charge]()'
collect2: ld returned 1 exit status
I am using Mandrake Linux in x86.
Thanks
Ricardo