Posted by ADnoctum on 1999-09-03
Hi,
I'm working with DJGPP in DOS and i have this problem. I have writed tree
files( list.h, list.cc and list_test.cc ) where i have the declaration of a
linked list like this:
// list.h
#ifndef LIST_H
#define LIST_H
template <class t>
class Node {
..
};
template <class t>
class List {
..
}
#endif
// list.cc
#include "list.h"
template <class t>
bool List<type>::append( type d ) {
.....
}
..code, code and more code...
Now if I write the main function on List.cc it works fine. Also, if i put it
on the the List_test.cc file and #include "list.cc"; but if i change it to
#include "list.h" i get a bunch of error messages like:
list_test.cc: undefined reference to 'List<int>::append( int d )'
..when is linking. I use this command
gcc list.cc list_test.cc -o list.exe
..or some times:
gcc -c list.cc
gcc -c list_test.cc
gcc list.cc list_test.cc -o list.exe
Previous post | Next post | Timeline | Home