Boost logo

Boost-Build :

From: John Maddock (john_at_[hidden])
Date: 2005-07-17 04:36:18


> Maybe this is helpful?
>
> boost/test/unit_test.hpp has the following lines:
>
> #if 0
> #ifndef BOOST_TEST_NO_AUTO_LINK
>
> #define BOOST_LIB_NAME unix_test_framework
> #define BOOST_LIB_DIAGNOSTIC yes
> #include <boost/config/auto_link.hpp>
>
> #endif
> #endif
>
> (which has been there as long as I can remember - and causes problems
> when you download boost and link to boost_unit_test_framework.lib with
> vc71 for the first time :)

What? How so? Note the "#if 0" this is all disabled for the test lib
(because the test lib can't tell which of it's many lib builds to link
against based upon which header you've included).

> if I change that to:
>
> #if 1
> #if !defined(BOOST_ALL_NO_LIB)
> #include <boost/config/auto_link.hpp>
> #endif
> #endif
>
> the link errror disappears.

How so, now you *have* turned on auto-linking.

> However, the next thing that happens is:
>
> boost_prg_exec_monitor.lib(cpp_main.obj) : error LNK2019: unresolved
> external symbol "int __cdecl cpp_main(int,char * * const)"
> (?cpp_main@@YAHHQAPAD_at_Z) referenced in function "public: virtual int
> __thiscall `anonymous namespace'::cpp_main_caller::function(void)"
>
> which I find curious, since I never had to link against that library
> where I used to link to 'boost_unit_test_framework.lib' only. (And
> still, gcc is not complaining).
>
> Why do I need a cpp_main when I turn of auto_link?
>
> I would be very happy if this is easily explained - and thus fixed :)

You need a cpp_main if you use the prg_exec_monitor lib, a test_main if you
link to the test lib, and a unit_test_main if you link to the unit test lib.
Clear, or just more confused? :-)

John.

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk