We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
test.h: -------
template <class T> class test {
public:
T * Pointer;
protected:
int * test_count;
test(unsigned int n);
~test(); };
test.cpp: ---------
#include "test.h"
template<class T> test<T>::test( unsigned int n) { My Code.. }
template<class T> test<T>::~test() { My Code... }
Main.cpp: --------- #include "test.h" int main(void){
test<char> Mydata1(10);
.... }
Built error:
testc++.axf: Error: L6218E: Undefined symbol test<char>::test(unsigned) (referred from main.o). testc++.axf: Error: L6218E: Undefined symbol test<char>::~test() (referred from main.o).
Well, the strange thing is if I put the function in the same way out of the class, but in the file test.h everything works!!!.
What is the problem? That putting the functions in and other file the linker don't see them.
I am using the compiler commands --C99 --cpp and --force_new_nothrow.
Thanks