再次编译我的测试套件时,我收到以下链接错误:
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;
}