Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linker 单元链接错误_Linker_Cppunit - Fatal编程技术网

Linker 单元链接错误

Linker 单元链接错误,linker,cppunit,Linker,Cppunit,在针对cppunit编译测试套件时,出现以下链接错误: error LNK2019: unresolved external symbol "public: virtual __thiscall CppUnit::TextTestRunner::~TextTestRunner(void)" (??1TextTestRunner@CppUnit@@UAE@XZ) referenced in function _wmain 我不理解这个问题,因为提供的示例链接很好 我正在使用宏注册我的测试: C

在针对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\u 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;
}

是否确定已将适当的库添加到项目的“链接器->输入->其他依赖项”文本框中?我认为应该是(对于发行版/Unicode版本):

testrunneru.lib cppunit.lib

您还需要确保链接器可以通过将适当的目录名添加到链接器->常规->其他库目录来找到库

一个真正的延伸,但它发生在我一次,是我需要重建单位。我想我的编译器已经升级或修补过了


如果您可以发布一个很短但完整的源文件来重现问题,这可能也会很有帮助。我想您只是缺少了这里的include语句?

是的,我将这些lib放在VS。