On Jun 20, 2013, at 8:38 PM, <boost-users-request@lists.boost.org>
 wrote:

Date: Thu, 20 Jun 2013 17:01:54 +0000 (UTC)
From: Gennadiy Rozental <rogeeff@gmail.com>
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [Test]: Problem with simple Boost.Test
Message-ID: <loom.20130620T185812-619@post.gmane.org>
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.