I am trying to use a template class and when I compile it in one file in LWS it works:
(Link is dead) ~http://liveworkspace.org/code/a9c412a7e683439dfa35a9363749369d~
But when I try to compile it made-up of 3 files,
stack.h lines 4 to 21
stack.cpp lines 24 to 48
main.cpp lines 49 to end
When I try to compile those 3 files I get
Undefined symbols for architecture x86_64:
"Stack2<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::push(Node**, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)", referenced from:
_main in ccCoizCT.o
"Stack2<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::top(Node*&)", referenced from:
_main in ccCoizCT.o
"Stack2<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::pop(Node*&)", referenced from:
_main in ccCoizCT.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Yes I have included stack.h in a stack.cpp and main.cpp files