unittest++

Post here any ideas/problems/suggestions you have regarding CodeLite's ExternalTools plugin
tony.jay
CodeLite Enthusiast
Posts: 10
Joined: Fri Aug 01, 2014 9:50 am
Genuine User: Yes
IDE Question: C++
Contact:

unittest++

Post by tony.jay » Tue Aug 05, 2014 11:31 am

A brief update.
I have been unable to get a version of Codelite to work with Windows no matter what I tried.
To try and get some traction I then downloaded Codelite onto my MBP.
I had some success in the sense that I then had a basic functioning environment.

Now I have been trying to get unittest++ to work without success.
Ater a lot of searching I discovered that the unit test libraries were not even downloaded even though the plug-in sits large as life
apparently integrated into the IDE.
After putting the libraries in the include path for the compiler I am using it then recognised the include directives for unittest++ but the plugin itself does not work and any code written will not compile.

The wiki entry on unittest++ appears to be redundant since it is impossible to even set up a project in the manner outlined there.

I have spent a lot of hours trying to get clarity without success.
Clearly I don't know what I don't know.

Codelite 6.0
MBP running OS X 10.9.4
Unittest++ library downloaded is 1.4

/bin/sh -c 'make -j4 -e -f Makefile'
----------Building project:[ source - Debug ]----------
/usr/bin/clang++ -c "/Users/richardjay/Documents/workspace/source/main.cpp" -g -O0 -Wall -o ./Debug/main.cpp.o -I/Users/richardjay/UnitTest++/src -I. -I. -I/Users/richardjay/UnitTest++
/usr/bin/clang++ -o ./Debug/source @"source.txt" -L/Users/richardjay/UnitTest++/src -L. -L/Users/richardjay/UnitTest++
Undefined symbols for architecture x86_64:
"UnitTest::CurrentTest::Details()", referenced from:
TestFailSpectacularly::RunImpl() const in main.cpp.o
"UnitTest::CurrentTest::Results()", referenced from:
TestFailSpectacularly::RunImpl() const in main.cpp.o
"UnitTest::RunAllTests()", referenced from:
_main in main.cpp.o
"UnitTest::TestDetails::TestDetails(UnitTest::TestDetails const&, int)", referenced from:
TestFailSpectacularly::RunImpl() const in main.cpp.o
"UnitTest::TestResults::OnTestFailure(UnitTest::TestDetails const&, char const*)", referenced from:
TestFailSpectacularly::RunImpl() const in main.cpp.o
"UnitTest::Test::GetTestList()", referenced from:
___cxx_global_var_init1 in main.cpp.o
"UnitTest::Test::Test(char const*, char const*, char const*, int)", referenced from:
TestFailSpectacularly::TestFailSpectacularly() in main.cpp.o
"UnitTest::Test::~Test()", referenced from:
TestFailSpectacularly::~TestFailSpectacularly() in main.cpp.o
"UnitTest::ListAdder::ListAdder(UnitTest::TestList&, UnitTest::Test*)", referenced from:
___cxx_global_var_init1 in main.cpp.o
"typeinfo for UnitTest::Test", referenced from:
typeinfo for TestFailSpectacularly in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Debug/source] Error 1
make: *** [All] Error 2
1 errors, 0 warnings

For what it is worth here is the entire build output above.
Tony Jay

User avatar
eranif
CodeLite Plugin
Posts: 5812
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: unittest++

Post by eranif » Wed Aug 06, 2014 10:02 pm

You don't link against the unitest++
Under ubuntu:

Code: Select all

sudo apt-get install libunittest++-dev
In anycase, you need to link against libUnitTest++

Open: project settings->common settings->linker->Libraries
and add:

Code: Select all

UnitTest++
Note that you need to have at least one test set properly for it to work properly.
To add tests, simply open the unittests main file (usually named main.cpp)
right click it and select UnitTest++->create new test

Eran
Make sure you have read the HOW TO POST thread

Post Reply