Boost logo

Boost :

From: Duft Markus (Markus.Duft_at_[hidden])
Date: 2008-03-05 04:03:11


Hello Martin!

First of all thanks for the answer.

Martin Schulz <> wrote:
> Hello Markus,
>
> you should not link your _application_ against boost test at all.
> IMHO, you should compile the test cases in a separate executable that
> runs all tests one after the other.

I had completely wrong information here. Our setup is exactly the one you described. The console app which links against the test framework doesn't link. Our main application links fine though (without the test framework of course)...

The error message is (sorry for the german messages... Damn i18n :)):

libboost_unit_test_framework.a(unit_test_main.obj) : error LNK2005: _main ist bereits in _check_owerrdialogs.o definiert.
libboost_unit_test_framework.a(framework.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class boost::unit_test::test_suite * __cdecl init_unit_test_suite(int,char * * const)" (?init_unit_test_suite@@YAPAVtest_suite_at_unit_test_at_boost@@HQAPAD_at_Z)" in Funktion ""void __cdecl boost::unit_test::framework::init(int,char * * const)" (?init_at_framework@unit_test_at_boost@@YAXHQAPAD_at_Z)".
wamas-test_global_checkowerrdialogs__check_owerrdialogs.exe : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.

Basically it says, there is allready a main in the test framework, and that there is no init_unit_test_suite which it would require.

>
> The simplest way to avoid any link hassle there is to have a single
> cpp
> file containing
>
> #define BOOST_AUTO_TEST_MAIN
> #include <boost/test/auto_unit_test.hpp>
> #include <boost/test/included/unit_test_framework.hpp>

I looked into the test program he is trying to link. It has a main() which does some initialization, and the adds some test cases. Should this be changed to be a init_unit_test_suite instead of main? If yes, does this work on all platforms, or is this just a windows thing?

Also i cannot find BOOST_AUTO_TEST_MAIN anywhere in the source, and boost/test/unit_test.hpp is included instead of auto_unit_test.hpp. unit_test_framework.hpp is also not included...

Cheers, Markus

>
> And compile this (together with your test cases) into a command line
> executable. That way, the linker has a little bit more to do on each
> compiler run, but you do avoid any mismatch of compiler options and
> the
> like.
>
> Yours,
>
>> -----Original Message-----
>> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]]
>> On Behalf Of Duft Markus
>> Sent: Donnerstag, 28. Februar 2008 08:42
>> To: boost_at_[hidden]
>> Subject: [boost] Problem linking Boost Unit Test Library on windows
>> (1.33.0)
>>
>> Hi!
>>
>> I have a problem linking our application on windows. Somebody added
>> test cases using the boost unit test library, and since then windows
>> won't link anymore. The problem is, that the boost library contains
>> a "main" and doesn't seem to contain a "init_unit_test_suite"
>> function (am I missing a library?). It works on all other systems,
>> is windows unsupported there?
>>
>> Is there any more information I should gather for you to see the
>> problem, or is this a known issue (I remember seeing something on the
>> list about this, but I think it was about a newer boost version. Can
>> any eventually made changes be expressed as a patch for 1.33.0 so I
>> can locally fix the issue, and won't need an upgrade)?
>>
>> Cheers, Markus
>> _______________________________________________
>> Unsubscribe & other changes:
>> http://lists.boost.org/mailman/listinfo.cgi/boost
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk