|
Boost Users : |
Subject: Re: [Boost-users] First attempt at using Boost::Test is a flop: the program ends with an exception related to std::string but I don't use any
From: Olaf Meeuwissen (olaf.meeuwissen_at_[hidden])
Date: 2012-05-21 19:13:30
"Ted Byers" <r.ted.byers_at_[hidden]> writes:
>> On 21/05/12 04:50, Ted Byers wrote:
>> > Here is the full output from my program:
>> >
>> > $ ./decision.test.suite
>> >
>> > terminate called after throwing an instance of 'std::logic_error'
>> >
>> > what(): basic_string::_S_construct NULL not valid
>> >
>> > Aborted (core dumped)
>> >
>> > Now, all the code in this program is focussed on number crunching, so
>> > none of it involves strings. I am guessing that I missed something in
>> > setting up a test suite.
>
> Actually, I found the culprit. I had assumed initially that all I'd needed
> was defined in a single header:
>
> #include <boost/test/unit_test.hpp>
>
> But, I continued investigating after I posted here, and observed that in the
> framework example it also had:
>
> #include <boost/test/included/unit_test.hpp>
>
> I added that to my file, and it still compiled, but what a difference at run
> time. The program now runs to completion without an exception. What I
> don't have in an explanation, or why I haven't found, yet, documentation
> that says what headers are needed in what test scenarios.
If memory serves me right,
#include <boost/test/included/unit_test.hpp>
pulls in the full code of the library. If you only
#include <boost/test/unit_test.hpp>
you need to link against the precompiled Boost.Test library. See
for details.
Hope this helps,
-- Olaf Meeuwissen, LPIC-2 FLOSS Engineer -- AVASYS CORPORATION FSF Associate Member #1962 Help support software freedom http://www.fsf.org/jf?referrer=1962
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