Boost logo

Boost Users :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2007-11-22 17:35:24


Sorry, for the delayed reply.

This looks like an issue uncovered right after 1.34.1 was out. The problem is that you compilation line picks up shared version of Boost.Test library, which doesn't include main anymore for portability reasons. You need to explicely specify that you intend to use static library or rename one of the libraries in your library location.

Gennadiy
  "Justin Paul" <justinpaul12_at_[hidden]> wrote in message news:20071112062824.30248.qmail_at_webmail61.rediffmail.com...
  Hi,

  I use the Boost library 1.34.1 on Ubuntu 7.10 (Gusty Gibbon). I get
  the following error while linking with libboost_unit_test_framework.

  user23_at_Mycomp:~/scrapbook$ g++ first.cpp -lboost_unit_test_framework
  /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crt1.o: In function `_start':
  (.text+0x18): undefined reference to `main'
  collect2: ld returned 1 exit status

  The first.cpp has the example given in the Boost website

  // Boost.Test
  #include <boost/test/unit_test.hpp>
  using boost::unit_test::test_suite;

  // most frequently you implement test cases as a free functions
  void free_test_function()
  {
      // reports 'error in "free_test_function": test 2 == 1 failed'
      BOOST_CHECK(2 == 1); // non-critical test => continue after failure

      int* p = (int*)0;
      *p = 0;
  }

  test_suite*
  init_unit_test_suite( int, char* [] ) {
      test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" );

      // this example will pass cause we know ahead of time number of expected failures
      test->add( BOOST_TEST_CASE( &free_test_function ), 1 /* expected one error */ );

      return test;
  }

  // EOF

  Thanks in Advance.

  Justin

------------------------------------------------------------------------------

  _______________________________________________
  Boost-users mailing list
  Boost-users_at_[hidden]
  http://lists.boost.org/mailman/listinfo.cgi/boost-users



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