How to use cvBlobsLib in OpenCV on Ubuntu-Collection of common programming errors

I have a huge problem using the cvBlobsLib with OpenCV under Ubuntu. I built the cvBlobsLib in the OpenCV lib folder and I included the header file to my main.cpp.

However, despite all my tries and google searches, I can’t find how to make it work. When I create a CBlobResult variable, after make I get this error:

CMakeFiles/bag.dir/main.o: In function `main':
main.cpp:(.text+0x28d): undefined reference to `CBlobResult::CBlobResult()'
main.cpp:(.text+0x3de): undefined reference to `CBlobResult::~CBlobResult()'
main.cpp:(.text+0x3fd): undefined reference to `CBlobResult::~CBlobResult()'
collect2: ld returned 1 exit status
make[2]: *** [bag] Error 1
make[1]: *** [CMakeFiles/bag.dir/all] Error 2
make: *** [all] Error 2

I think the problem is that the linker can’t find the cvBlobsLib package. I’m using CMake, but I have no idea how to solve this problem.

Originally posted 2013-11-10 00:17:04.