在针对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
下面是“main”代码:
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;
}发布于 2009-01-29 18:12:52
是否确定已将适当的库添加到项目的“链接器->输入->附加依赖项”文本框中?我相信它应该是(对于发布/ Unicode版本):
testrunneru.lib cppunit.lib
您还需要确保链接器可以通过将适当的目录名添加到链接器->常规->附加库目录来找到该库。
一个真正的延伸,但它发生在我身上的一次,是我需要重建cppunit。我想我的编译器被升级或打了补丁。
如果您可以发布一个非常简短但完整的源文件来再现问题,这也会很有帮助。我想您在这里只遗漏了include语句?
https://stackoverflow.com/questions/492518
复制相似问题