I'm a novice in C++ programming.
I wrote a ReadFile class in file ReadFile.cpp.
After that, I wrote a test.cpp, which contains a main function, to test whether my class work well.
I follow the following steps to compile the ReadFile.cpp file.
g++296 -c ReadFile.cpp -o ReadFile.o
g++296 ReadFile.o test.cpp -o test.o
I got two link error.
One mention that one of my funtions which called atoi contained in ReadFile.o was duplicated declared in file/tmp/xxxxxx.o(xxxxxx varies each time I link the program).
The other says one of the pointer in main function ReadFile *read_file_ = new ReadFile() was undefined reference to ReadFile's virtual table.
Would someone be kind enough to tell me how can I solve the problem?
Thank you for your kind reply.
This is the way I did before.
It's true that I've made test.o and use ld to link both file.
But I failed again.
Tens of errors appeared.
It seems that they can't find the corresponding system library.
My system is RH AS3 Upate2.
Do you have any other suggestion?
Thank you for your kindness.
It's true that I found the solution.
I declared a virtual destructor.
Unfortunately, I didn't implement it.
As a result, I got the error.