テスト スイートを cppunit に対してコンパイルすると、次のリンク エラーが発生します。
error LNK2019: unresolved external symbol "public: virtual __thiscall CppUnit::TextTestRunner::~TextTestRunner(void)" (??1TextTestRunner@CppUnit@@UAE@XZ) referenced in function _wmain
提供された例は問題なくリンクしているため、この問題はわかりません。
マクロを使用してテストを登録しています。
CPPUNIT_TEST_SUITE_REGISTRATION
CPPUNIT_TEST_SUITE
etc
私のテストクラスは CPPUNIT_NS::TestFixture から派生しています
ここに「メイン」コードがあります:
int _tmain(int argc, _TCHAR* argv[])
{
// Get the top level suite from the registry
CPPUNIT_NS::Test *suite = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
// Adds the test to the list of test to run
CPPUNIT_NS::TextUi::TestRunner runner;
runner.addTest( suite );
// Change the default outputter to a compiler error format outputter
runner.setOutputter( new CPPUNIT_NS::CompilerOutputter( &runner.result(),
CPPUNIT_NS::stdCOut() ) );
// Run the test.
bool wasSucessful = runner.run();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}