B
Bart Vandewoestyne
I'm trying to run one of the examples from item 14 in Scott Meyer's Effective C++ book. As suggested in the book, I already made the EnemyTarget destructor virtual, so I assume the code should compile and run just fine. This is what I have:
https://github.com/BartVandewoestyne/cpp/tree/master/books/Effective_C++/item14
I'm compiling with g++ 4.6.2 and get:
$ g++ main.cpp
/tmp/ccOt7F5P.o: In function `EnemyTarget::EnemyTarget()':
main.cpp.gnu.linkonce.t._ZN11EnemyTargetC2Ev+0xf): undefined reference to `vtable for EnemyTarget'
/tmp/ccOt7F5P.o: In function `EnemyTank::EnemyTank()':
main.cpp.gnu.linkonce.t._ZN9EnemyTankC1Ev+0x1f): undefined reference to `vtable for EnemyTank'
main.cpp.gnu.linkonce.t._ZN9EnemyTankC1Ev+0x26): undefined reference to `EnemyTank::numTanks'
main.cpp.gnu.linkonce.t._ZN9EnemyTankC1Ev+0x31): undefined reference to `EnemyTank::numTanks'
collect2: ld returned 1 exit status
but I don't see why... I already checked the errate on Scott's website, but can't find anything that helps me forward.
What am I missing here?
Regards,
Bart
https://github.com/BartVandewoestyne/cpp/tree/master/books/Effective_C++/item14
I'm compiling with g++ 4.6.2 and get:
$ g++ main.cpp
/tmp/ccOt7F5P.o: In function `EnemyTarget::EnemyTarget()':
main.cpp.gnu.linkonce.t._ZN11EnemyTargetC2Ev+0xf): undefined reference to `vtable for EnemyTarget'
/tmp/ccOt7F5P.o: In function `EnemyTank::EnemyTank()':
main.cpp.gnu.linkonce.t._ZN9EnemyTankC1Ev+0x1f): undefined reference to `vtable for EnemyTank'
main.cpp.gnu.linkonce.t._ZN9EnemyTankC1Ev+0x26): undefined reference to `EnemyTank::numTanks'
main.cpp.gnu.linkonce.t._ZN9EnemyTankC1Ev+0x31): undefined reference to `EnemyTank::numTanks'
collect2: ld returned 1 exit status
but I don't see why... I already checked the errate on Scott's website, but can't find anything that helps me forward.
What am I missing here?
Regards,
Bart