リンクエラー : undefined reference to virtual table
クラスを仮想継承してリンクした時に
"undefined reference to virtual table"
というリンクエラーが表示された。
原因:宣言しているのに定義していないこと。
要するに以下の様な状態
// パターン(宣言のみ) class TestA : virtual private Base { public: TestA(); virtual ~TestA(); } // パターン(宣言と定義) class TestB : virtual private Base { public: TestB() {} virtual ~TestB() {} }
自分が間違えた時のパターンは以下の様なパターン
class Test : virtual private Base { (...) public: (...) virtual ~Test(); // ← 宣言のみで定義なし }