Boost logo

Boost Users :

Subject: Re: [Boost-users] [Test]: Problem with simple Boost.Test
From: Damien Kick (dkick_at_[hidden])
Date: 2013-06-21 12:34:02


On Jun 20, 2013, at 8:38 PM, <boost-users-request_at_[hidden]<mailto:boost-users-request_at_[hidden]>>
 wrote:

Date: Thu, 20 Jun 2013 17:01:54 +0000 (UTC)
From: Gennadiy Rozental <rogeeff_at_[hidden]<mailto:rogeeff_at_[hidden]>>
To: boost-users_at_[hidden]<mailto:boost-users_at_[hidden]>
Subject: Re: [Boost-users] [Test]: Problem with simple Boost.Test
Message-ID: <loom.20130620T185812-619_at_[hidden]<mailto:loom.20130620T185812-619_at_[hidden]>>
Content-Type: text/plain; charset=utf-8

thusly:$ ${CXX} -c --std=c++0x -g -I${TARGET}/include cma.cpp -o cma.o
$ ${CXX} --std=c++0x -g cma.o ${TARGET}/lib/libboost_test_exec_monitor.a \
${TARGET}/lib/libboost_unit_test_framework.dylib -o cma

I know docs are not ideal but this part is very clear I thought.
test_exec_monitor is an old alternative t ounit test framework, which is
long deprecated and they definitely do not require each other

In this case, I wouldn't fault the docs per se but rather only my impatience in having tried "jumping directly to the subject of [my] interest" but not yet having realized exactly what my subject of interest really is/was nor how far I needed to jump in order to get to it ;-) I had been trying this:

$ cat cma.cpp
#define BOOST_TEST_MODULE cma
#include <boost/test/unit_test.hpp>

#include <iostream>
#include <ostream>

BOOST_AUTO_TEST_CASE(sanity)
{
    std::clog << "Test the world!\n";
}
$ ${CXX} -c --std=c++0x -g -I${TARGET}/include cma.cpp -o cma.o
$ ${CXX} --std=c++0x -g cma.o ${TARGET}/lib/libboost_unit_test_framework.dylib -o cma
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
$

But when I started reading through more of the documentation and got as far as <http://preview.tinyurl.com/lw7e688>, I realized that I needed to be doing something more like this:

$ ${CXX} -c --std=c++0x -g -DBOOST_TEST_DYN_LINK -I${TARGET}/include cma.cpp -o cma.o
$ ${CXX} --std=c++0x -g cma.o ${TARGET}/lib/libboost_unit_test_framework.dylib -o cma
$ env DYLD_LIBRARY_PATH=${TARGET}/lib ./cma
Running 1 test case...
Test the world!

*** No errors detected
$

Thank you, Gennadiy, for having taken the time to respond to my question as well as having taken the time you spent on Boost.Test.

________________________________

This e-mail and any attachments are confidential. If it is not intended for you, please notify the sender, and please erase and ignore the contents.



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