我有一个项目使用 cppunit 进行单元测试,我使用 QTtestrunner 来显示结果这里是代码
CPPUNIT_NS::QtUi::TestRunner testrunner;
testrunner.addTest (CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
testrunner.run (true);
但我在编译时收到了这条消息:
src/main.cpp:78: undefined reference to 'CppUnit::QtTestRunner::QtTestRunner()'
src/main.cpp:79: undefined reference to CppUnit::QtTestRunner::addTest(CppUnit::Test*)'
src/main.cpp:80: undefined reference to CppUnit::QtTestRunner::run(bool)'
src/main.cpp:91: undefined reference to 'CppUnit::QtTestRunner::~QtTestRunner()'
我知道存在链接问题,但我包含了所有我需要的 libcppunit.a 和 libcppunit.so