Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Test with a static library
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-11-21 13:58:21

Moritz Beber <moritz.beber <at>> writes:

> Hello everyone,

Hello, guys

I had to step away from support for a bit, but now I am planning to
reply to all the posts.

> after prying for any hints in the documentation

Should probably start here:

> and reading frustrating mails in the archives for a while now, I get
> the feeling that this is a very confusing topic.

I don't think so. There was some confusion about dynamic library
variant, but the static library was there from the beginning and never
really changed much.

> My aim is to use a static library of boost.test because I need to
> compile it a lot and the waiting time when using the header is just
> frustrating.


> So I added to the "Jamfile.v2" in "libs/test/build" under "requirements"
> the following line:

Why? Didn't it work for you out of the box?

> Then I used and apart from a few warnings like:
> ./boost/test/detail/config.hpp:85:1: warning:

This is a bit fishy. This place is only related to the dynamic library
variant. Though maybe Boost.Build builds both with single command and
it's fine in that case.

> Then I tried the following code, which I mostly copied from the
> documentation, except for adding two macros:
> #define BOOST_TEST_MODULE example
> #include <boost/test/unit_test.hpp>
> BOOST_AUTO_TEST_SUITE( test_suite1 )
> BOOST_AUTO_TEST_CASE( test_case1 )
> {
> BOOST_WARN( sizeof(int) < 4 );
> }


> When I try to compile, however, I get the following
> error:
> In function `main':
> unit_test_main.cpp:(.text+0x2229): undefined reference to
> `init_unit_test()'
> collect2: ld returned 1 exit status

Works fine for me. I just tried and reproduce your exercise.

Maybe clean build would help? Also try to see on results from
preprocessor: check if init_unit_test is there.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at