Getting started with UnitTest ++

This is the current code that I have from their fundamental example: http://unittest-cpp.sourceforge.net/UnitTest++.html

#include <unittest++/UnitTest++.h> TEST(FailSpectacularly) { CHECK(false); } int main() { return UnitTest::RunAllTests(); } 

An inclusion exists, but I get errors: undefined reference to UnitTest::Test::* and UnitTest::* , where * is some arbitrary class / method in the UnitTest ++ library.

How can I get this to compile correctly?

+7
source share
2 answers

Found the answer here: http://comments.gmane.org/gmane.comp.lang.c%2B%2B.unittest%2B%2B.devel/13

Define the library path -L/usr/include and the library -lunittest++

+4
source

Mostly for my future reference, but I sorted it by linking it to the last library.

 g++ test.cpp -lunittest++ 
+2
source

All Articles