Hi!
Sorry for posting this here, but I don't know where else to ask.
I've tried to compile the following program:
b.h
===
template <class t>
class b
{
public:
b();
~b();
};
b.cpp
=====
#include "b.h"
template <class t>
b<t>::b() {}
template <class t>
b<t>::~b() {}
main.cpp
========
#include "b.h"
int main() {
b<int> bi;
b<float> bf;
return 0;
}
g++ -c main.cpp and g++ -c b.cpp compiles the sources, but
g++ -o prg b.o main.o fails:
main.o(.text+0x18): In function `main':
: undefined reference to `b<int>::b[in-charge]()'
main.o(.text+0x23): In function `main':
: undefined reference to `b<float>::b[in-charge]()'
main.o(.text+0x2e): In function `main':
: undefined reference to `b<float>::~b [in-charge]()'
main.o(.text+0x39): In function `main':
: undefined reference to `b<int>::~b [in-charge]()'
main.o(.text+0x4c): In function `main':
: undefined reference to `b<int>::~b [in-charge]()'
collect2: ld returned 1 exit status
I use g++ (GCC) 3.2.2.
What did I wrong ?
regards,
Akos
--
[EMAIL PROTECTED] mailing list