From: Marc Mutz (marc_at_[hidden])
Date: 2006-07-09 12:17:12
On Friday 07 July 2006 04:40, Joe Van Dyk wrote:
> I'm trying to get something like the following to work:
> test_case1.cpp and test_cast2.cpp are compiled into a static library
> (libtest.a). They use BOOST_AUTO_TEST_CASE for test cases.
> test_main.cpp contains:
> #define BOOST_AUTO_TEST_MAIN
> #include <boost/test/auto_unit_test.hpp>
> However, when I compile test_main.cpp and link libtest.a into it, none
> of the test cases run.
> The test cases do run if test_main.cpp #includes test_case1.cpp and
> test_case2.cpp, but I'd rather not do that if it's not necessary.
> Any ideas?
I'm guessing here :)
Registration of tests with the runner is done using file-static instances of
some generic factory or other registration mechanism. If none of the symbols
of given object file is referenced outside itself, the linker does not
include the code from the object file in the final executable. Use dynamic
libs, or link the object files instead of the archives.
-- Marc Mutz -- marc_at_[hidden], mutz_at_[hidden] Klarälvdalens Datakonsult AB, Platform-independent software solutions
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk