I have a very simple program
********************************************************************
#include <iostream>
#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;

void MyTest()
{
        BOOST_CHECK(2==2);
}

test_suite * init_unit_test_suite( int, char* [] ) {
  test_suite* test= BOOST_TEST_SUITE( "Simple test" );
  test->add(BOOST_TEST_CASE( &MyTest ), 0);
  return test;
}
****************************************************************************************
I am trying to compile it using the following commands

g++ -c BoostTest.cpp -I~/boost/include/boost-1_33_1/
g++ -o BT BoostTest.o -I/home/josh/boost/include/boost-1_33_1/ /home/josh/boost/lib/libboost_unit_test_framework-gcc-s.a

The first step completes without a problem, the linking stage gives the following
errors

BoostTest.o(.text+0x15b): In function `MyTest()':
: undefined reference to `boost::test_tools::tt_detail::test_and_continue_impl(bool, boost::basic_wrap_stringstream<char>&, boost::unit_test::basic_cstring<char const>, unsigned int, bool, boost::unit_test::log_level)'
BoostTest.o(.text+0x258): In function `init_unit_test_suite(int, char**)':
: undefined reference to `boost::unit_test::test_suite::add(boost::unit_test::test_case*, unsigned long, int)'
BoostTest.o(.gnu.linkonce.t._ZN5boost9unit_test16create_test_caseEPFvvESs+0x12): In function `boost::unit_test::create_test_case(void (*)(), std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
: undefined reference to `boost::unit_test::ut_detail::normalize_test_case_name(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
BoostTest.o(.gnu.linkonce.t._ZN5boost9unit_test18function_test_caseC1EPFvvENS0_13basic_cstringIKcEE+0x1b): In function `boost::unit_test::function_test_case::function_test_case(void (*)(), boost::unit_test::basic_cstring<char const>)':
: undefined reference to `boost::unit_test::test_case::test_case(boost::unit_test::basic_cstring<char const>, bool, unsigned long, bool)'
BoostTest.o(.gnu.linkonce.r._ZTVN5boost9unit_test18function_test_caseE+0x10): undefined reference to `boost::unit_test::test_case::size() const'
BoostTest.o(.gnu.linkonce.t._ZN5boost9unit_test9test_caseD2Ev+0xc): In function `boost::unit_test::test_case::~test_case()':
: undefined reference to `vtable for boost::unit_test::test_case'
BoostTest.o(.gnu.linkonce.r._ZTIN5boost9unit_test18function_test_caseE+0x8): undefined reference to `typeinfo for boost::unit_test::test_case'

*************************************************************

PLEASE HELP!
Josh


Want to be your own boss? Learn how on Yahoo! Small Business.