Boost logo

Boost Users :

Subject: Re: [Boost-users] boost-test with wxWidgets
From: Matěj Týč (matej.tyc_at_[hidden])
Date: 2009-01-07 08:02:48


Thank you for your reply,
>> Simplest approach is to use dynamic library variant of the UTF
>> I have noticed that I don't have to pass any libraries to the compiler
>> and everything links fine when #defining BOOST_TEST_DYN_LINK, however
>
> I believe you still have to, isn't it?
I don't have to. When I copy the contents of Example 9 into a cpp file
and then run g++ on it, if the macro BOOST_TEST_DYN_LINK is #defined,
I have to wait a little bit, but I get no linking errors at all. I
just run 'g++ file.cpp' with no additional parameters... And it works
even when BOOST_TEST_NO_LIB is #defined. Strange, isn't it?
>
>> it takes a lot of time to compile. I am on Linux and I use autotools
>> that pass the -lboost_unit_test_framework-mt flag to the linker.
>
> What does this lead to? I mean will it link with static or shared library?
It should mean the dynamic one (they have the same name, but shared
linking is the default one. But this probably has no effect)
When you #define BOOST_TEST_DYN_LINK, you don't have to worry about
linking (see above). When you don't #define BOOST_TEST_DYN_LINK, you
get quite a lot of errors about wrong parameters (still when compiling
the Example 9 from the boost manual).
These are those errors (after #defining BOOST_TEST_NO_MAIN):
test.cpp: In function 'int main(int, char**)':
test.cpp:34: error: invalid conversion from 'bool (*)()' to
'boost::unit_test::test_suite* (*)(int, char**)'
test.cpp:34: error: initializing argument 1 of 'int
boost::unit_test::unit_test_main(boost::unit_test::test_suite*
(*)(int, char**), int, char**)'

Example 9: http://www.boost.org/doc/libs/1_37_0/libs/test/doc/html/utf/user-guide/test-organization/manual-nullary-test-case.html#utf.user-guide.test-organization.manual-nullary-test-case.example05

>
>> However, I still get undefined references or compilation errors when
>> BOOST_TEST_DYN_LINK is not defined...
>
> Please post them.
>
Let's forget about undefined references, the problem seems to be that
the library has different function forms depending whether the
BOOST_TEST_DYN_LINK is #defined or not. What is annoying is that It
takes quite a long time to compile the tests and I suspect that some
invisible linking or compilation of Boost testing library is taking
place there.
Any ideas?

Regarding automatic registration: I had problems with it because I
have not #defined the BOOST_TEST_DYN_LIN symbol. Now everything seems
to be OK to me.

Thank you very much for your help.
How could I contribute to the documentation? I think that what I have
learned may be useful to others
Matej


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net