CppUTest example doesn't work

1.7k views Asked by At

I just installed CppUTest on my MAC using brew as indicated by the guide. It failed when I tried to build the example cpp.

TEST_GROUP(FirstTestGroup)
{
};

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

I guess it is because the header file which define those macros are not included. So I add include as below:

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

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

Now I get bunch of errors.

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

There are 1 answers

2
Bas Vodde On BEST ANSWER

The error you are getting is a linker error and it suggests that you are not linking the CppUTest library. It is hard to actually say what is wrong because your question is missing the Makefiles. Could you explain how you have compiled the example?