CppUTest示例不起作用

时间:2013-08-26 21:59:26

标签: macos cpputest

我刚刚使用brew在我的MAC上安装了CppUTest,如指南所示。 当我尝试构建示例cpp时,它失败了。

TEST_GROUP(FirstTestGroup)
{
};

TEST(FirstTestGroup, FirstTest)
{
   FAIL("Fail me!");
}

我想这是因为没有包含定义这些宏的头文件。所以我添加include如下:

#include "CppUTest/TestHarness.h"
#include "CppUTest/TestOutput.h"
TEST_GROUP(FirstTestGroup)
{
};

TEST(FirstTestGroup, FirstTest)
{
   FAIL("Fail me!");
}

现在我收到一堆错误。

Undefined symbols for architecture x86_64: "UtestShell::assertTrue(bool, char const*, char const*, char const*, int)", referenced from: vtable for TEST_FirstTestGroup_FirstTest_TestShellin ccNDwnbv.o

1 个答案:

答案 0 :(得分:0)

您获得的错误是链接器错误,它表明您没有链接CppUTest库。实际上很难说出错是什么,因为你的问题缺少Makefile。你能解释一下你是如何编写这个例子的吗?

相关问题