title: Boost::Test : Compiling and running a "hello world" program
body: <p>I am trying to get a dummy Boost.test "hello world" program running. I found documentation <a href="http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/tutorials/new-year-resolution.html" rel="noreferrer">here</a> and <a href="http://www.ibm.com/developerworks/aix/library/au-ctools1_boost/index.html" rel="noreferrer">there</a> but obviously there is something I am missing…</p>
  
  <p>Here is what I have done :</p>
  
  <h2>Step #1 : I installed the dependencies</h2>
  
  <pre><code>sudo aptitude install libboost-test-dev
  </code></pre>
  
  <p>which installs both the headers (<code>libboost-test1.54-dev</code>) and the binary files (<code>libboost-test1.54.0</code>).</p>
  
  <h2>Step #2 : Creating the source file to be compiled</h2>
  
  <p>I have one single file called <code>test.cpp</code> which contains :</p>
  
  <pre><code>#define BOOST_TEST_MODULE const_string test
  #include &lt;boost/test/unit_test.hpp&gt;
  
  // EOF
  </code></pre>
  
  <p>as was recommended in the <a href="http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/tutorials/new-year-resolution.html" rel="noreferrer">official tutorial</a></p>
  
  <h2>Step #3 : Compilation</h2>
  
  <p>I compile my code by calling :</p>
  
  <pre><code>g++ test.cpp -lboost_unit_test_framework
  </code></pre>
  
  <p>I am not 100% sure about the option to link the library since the <a href="http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/tutorials/new-year-resolution.html" rel="noreferrer">official tutorial</a> does not mention it explicitly. Yet, it seems to match the library file names I have in <code>/usr/lib</code>. Plus, the linker does not complain about not finding the shared object or static library files.</p>
  
  <p>Which returns the following error :</p>
  
  <pre><code>/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start':
  (.text+0x20): undefined reference to `main'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <h2>The issue</h2>
  
  <p>I quite agree with the linker : I don't see any <code>main()</code> function in my code… But where and how should I implement it ?</p>
  
  <p>I am quite surprised because I was expecting to have to create a <code>runner.cpp</code> file defining function <code>main()</code> but the official <a href="http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/tutorials/new-year-resolution.html" rel="noreferrer">boost tutorial</a> does not mention such a thing…</p>
  
  <p>This <a href="https://stackoverflow.com/questions/12529470/boost-unit-testing-main-function">answer</a> suggests defining the <code>BOOST_TEST_NO_MAIN</code> macro, but the official boost tutorial does not mention it either. Is that the proper way of doing it ?</p>
  
  <p>Could someone please give me clear step-by-step instructions on how to make my dummy "hello world" project compile ?</p>