Hello,
I used CppUTest on Mac before without problem.
But now I wanted to switch to Ubuntu and get the following error message for a minimal example:
test.cpp:7: undefined reference to `CommandLineTestRunner::RunAllTests(int, char**)'
test.o: In function `TEST_FirstTestGroup_FirstTest_Test::testBody()':
/home/pmueller/develop/minimal_runtime/tests/test.cpp:25: undefined reference to `UtestShell::getCurrent()'
/home/pmueller/develop/minimal_runtime/tests/test.cpp:25: undefined reference to `NormalTestTerminator::~NormalTestTerminator()'
/home/pmueller/develop/minimal_runtime/tests/test.cpp:25: undefined reference to `NormalTestTerminator::~NormalTestTerminator()'
test.o: In function `__static_initialization_and_destruction_0':
/home/pmueller/develop/minimal_runtime/tests/test.cpp:23: undefined reference to `TestInstaller::TestInstaller(UtestShell&, char const*, char const*, char const*, int)'
/home/pmueller/develop/minimal_runtime/tests/test.cpp:23: undefined reference to `TestInstaller::~TestInstaller()'
test.o: In function `TestTerminator::TestTerminator()':
And this goes on ...
My main looks like:
#include <CppUTest/CommandLineTestRunner.h>
#include <stdint.h>
int main(int ac, char** av){
int result = CommandLineTestRunner::RunAllTests(ac, av);
return result;
}
TEST_GROUP(FirstTestGroup)
{
void setup()
{
}
void teardown()
{
// Uninit stuff
}
};
TEST(FirstTestGroup, FirstTest)
{
CHECK_TRUE(1); // true because the buffer is empty
}
And Make looks like this:
all: test
export CPPUTEST_HOME=/usr/local
CPPFLAGS += -I$(CPPUTEST_HOME)/include
LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
test: test.o
g++ -g $(LD_LIBRARIES) -o test test.o
test.o: test.cpp
g++ -g $(CPPFLAGS) -c test.cpp
clean:
rm -f *.o test
I could built CppUTest without problems. And I checked that the lib and include path is correct.
Any idea?
Thanks,
Peter