【问题标题】:Getting Started with UnitTest++UnitTest++ 入门
【发布时间】:2011-08-20 21:07:32
【问题描述】:

这是我从他们的基本示例中获得的当前代码:http://unittest-cpp.sourceforge.net/UnitTest++.html

#include <unittest++/UnitTest++.h>

TEST(FailSpectacularly)
{
    CHECK(false);
}

int main() {
    return UnitTest::RunAllTests();
}

包含存在但我收到错误:undefined reference to UnitTest::Test::*UnitTest::* 其中* 是 UnitTest++ 库中的一些任意类/方法。

我怎样才能让它正确编译?

【问题讨论】:

  • 你试过 cppUnit 吗?
  • 除了CppUnit::SourceLine() 和更多undefined references 之外的错误

标签: c++ unit-testing unittest++


【解决方案1】:

在这里找到答案:http://comments.gmane.org/gmane.comp.lang.c%2B%2B.unittest%2B%2B.devel/13

设置库路径-L/usr/include和库-lunittest++

【讨论】:

    【解决方案2】:

    主要是为了我将来的参考,但我通过链接到图书馆last进行排序。

    g++ test.cpp -lunittest++
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-15
      • 2010-09-21
      • 1970-01-01
      • 1970-01-01
      • 2011-06-26
      相关资源
      最近更新 更多