Boost logo

Boost Users :

Subject: Re: [Boost-users] segfault using boost test
From: Jürgen Hunold (juergen.hunold_at_[hidden])
Date: 2010-11-09 10:27:43


Hi Davie,

On Monday, 8. November 2010 21:19:33 David M.Lee wrote:
> Here's the test I'm running:
>
> #define BOOST_TEST_MODULE simple
> #include <boost/test/included/unit_test.hpp>

Why do you use the "included" version of Boost.Test anyway?

> Even stranger: I only get the segfault if I link against
> unit_test_framework.

Yes, this is a classical ODR violation. You get one Boost.Test library built
by "included" and a second instance linked in. And all bets are off.

Either use the "included" variant or link against the lib.

The correct #include for linking against the library is

 #include <boost/test/unit_test.hpp>

Yours,

Jürgen

-- 
* Dipl.-Math. Jürgen Hunold       ! Ingenieurgesellschaft für 
* voice: ++49 511 262926 57       ! Verkehrs- und Eisenbahnwesen mbH  
* fax  : ++49 511 262926 99       ! Lister Straße 15
* juergen.hunold_at_[hidden]        ! www.ivembh.de
* 
* Geschäftsführer:                ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer    ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke       !

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