Boost logo

Boost :

Subject: Re: [boost] [test] Using the Boost Unit Test Framework with shared libs
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-24 12:41:11


Peter wrote:
> I am using Boost.Test from the current boost 1.38 , on cygwin ( gcc )
> and I want to use it with multiple test files and with shared libs ( in
> order to speed up the compilation time which is too long for me when
> using the header include variant ).
> What is the recommended way ? ( I read the doc, several times and I read
> the _long_ threads on the mailing list concerning the static/shared
> library issue, but I am not sure that I understood all the details).
> I did the following:
> *in mainTest.cpp:*
> #include "../inc/globalFixture.hpp"
> #include "../inc/testfile1.hpp"
> #include "../inc/testfile2.hpp"

If you're going to use multiple files, it's better not to
include everything in a single translation unit.
As long as BOOST_TEST_MAIN and
BOOST_TEST_MODULE are only defined
in one translation unit you can link multiple
translation units together. BOOST_TEST_DYN_LINK
needs to be defined in every translation unit.

> *I then link to
> The link passes , but I get a warning from gcc++ 3.4.4 that auto-linking
> has been enabled ( I will provide the exact details if useful ).

If you mean auto-import, that's normal on cygwin.

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at