$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2008-03-12 17:22:49
Hello Gennadiy,
thanks for your quick response.
> BOOST_TEST_NO_LIB is used to prevent auto-linking and in general has nothing
> to do with the problem you expirience.
My link problems where auto-linking problems, so they have something to do with BOOST_TEST_NO_LIB. (I know that Markus Duft had other Problems, but all I did was describe him my "setup", because it 'works for me', so I ventured that it might also work for him.)
> > Is this the "officially supported" solution? But how am I supposed to
> > know from the sources that globally defining "BOOST_TEST_NO_LIB" is the
> > expected way to do it, while defining "BOOST_TEST_INCLUDED" is "fidhy"?
>
> Try reading new docs or post an example that fails to link here and I will
> show a right way.
The new docs are nice (and I have an idea now how to avoid my problem), but I will first describe my example that fails:
I have multiple source files. The file where the function "init_unit_test_suite" is defined contains the line
#include <boost/test/included/unit_test.hpp>
while all other files contain the line
#include <boost/test/unit_test.hpp>
Because "boost/test/unit_test.hpp" contains a line that will use the auto-linking feature if
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \
!defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED)
I thought that I have to define at least one of these 4 macros, if I want to avoid auto-linking problems. I initially thought that defining BOOST_TEST_INCLUDED is the "officially supported" solution, since my scenario is 'Using "included" option'. My next guess was that defining BOOST_TEST_NO_LIB is the "officially supported" solution.
Now you tell me that globally defining any macro at all is already a mistake, so I guess I'm not allowed to include "unit_test.hpp" in more than one source file, and should replace
#include <boost/test/unit_test.hpp>
by
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test_suite.hpp>
Correct?
> > Or is globally defining "BOOST_TEST_NO_LIB" just as "fidhy" as globally
> > defining "BOOST_TEST_INCLUDED"?
>
> I am not why your sarcasm is warranted here. I am just trying to help.
Sorry for the sarcasm. I was a bit annoyed by the typo in the link to the new documentation. I'm really happy with boost/test, because it allows me to concentrate on my unit-tests without bothering to much with the unit-test framework. I used cppunit before, but switched to boost/test, because it was both simpler to use and more powerful (well designed messages for test failures, memory leak detection, easy integration into tool chains, ...). When upgrading to boost 1.34.1, I had to figure out how to make my unit-tests link again on windows. Making them link again was quite easy, but I would have preferred to know the "officially supported" solution, because upgrading to boost 1.35 might otherwise again break something.
Regards,
Thomas