Boost logo

Boost Users :

Subject: [Boost-users] UTF: test/included/unit_test.hpp vs test/unit_test.hpp
From: Manav Bhatia (bhatiamanav_at_[hidden])
Date: 2017-05-04 03:14:36


  I am using the UTF in my code. Below is the key component of my code that I have been using on Mac for a few years with boost installed from macports.

#include <boost/test/unit_test.hpp>

// C++ includes
#include <memory>

struct GlobalTestFixture {
    GlobalTestFixture() {
        /* my code here */

    ~GlobalTestFixture() {

BOOST_GLOBAL_FIXTURE( GlobalTestFixture );

A few days ago I started using this code on Ubuntu and kept getting segmentation faults with random values being returned for boost::unit_test::framework::master_test_suite().argc

I managed to get rid of this problem by changing the included header to
#include <boost/test/included/unit_test.hpp>

I have seen the description here: <>. However, I am not quite able to follow why this problem occurred on Ubuntu (with system boost library) when I was still linking against the precompiled library (version 1.58).

Is there a test I can include in my code to automatically switch from one include to the other?

I will appreciate some guidance.


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