I am trying to link some of the object files so that I can write tests using UnitTest++ in the Codelite IDE. Mysteriously, the tutorial does not say how to use .o
files from a (different) project.
If I was using the command line, this thread shows me how to do that. However, I am having more difficulty in the Codelite editor. The accepted answer in this other thread says "[i]n the codelite's IDE, this is added in the linker's option textbox," however, I am not finding that to be the case.
I add the path to these .o
files in the Library Search Path
spot, and then I add the name of the individual files in the Libraries
spot just below this. When I do this I get the /usr/bin/ld: cannot find -l<stuff>
error. If I omit the names of the specific files in the Library
spot, I get the undefined reference to
error.
Do I have to compile the original project as a library to get around this? Or is there a solution I don't see? The my_class_test.cpp
file that I want to run looks something like this:
#include <UnitTest++/UnitTest++.h>
#include "my_class.h"
SUITE(MyClassTest)
{
class MCFixture
{
public:
MyClass me;
MCFixture() : me("a", "b", "c") {};
};
TEST_FIXTURE(MCFixture, ConstructorTest)
{
CHECK_EQUAL(1.0, 1.0);
}
} //SUITE(MyClassTest)