How to install CUnit on Ubuntu?

6.7k Views Asked by At

I am having a problem in installing CUnit on Ubuntu.

I tried

sudo apt install libcunit1 libcunit1-doc libcunit1-dev

after the command

CUnit --version

says command not found.

I searched and was unable to find anything. Does anyone have a reliable solution? Thanks in advance!

2

There are 2 best solutions below

0
eman On

Have you tried

To use CUnit framework in your project, you must install it first

sudo apt-get install libcunit1 libcunit1-doc libcunit1-dev

Then in your test.c

#include <CUnit/CUnit.h>

And finally, you must add the flag –lcunit to the gcc command (at the end)

gcc  -o test test.c  -lcunit

From: https://mysnippets443.wordpress.com/2015/03/07/ubuntu-install-cunit/

NB: I have not tried this myself.

0
Calvin Passmore On

CUnit isn't an executable, so CUnit --version won't work. It's just a library.

You can check installation by looking at the installation location. For me it installed in /usr/lib/x86_64-linux-gnu/libcunit.* (there are a couple files)