|
Boost Users : |
From: Justin Paul (justinpaul12_at_[hidden])
Date: 2007-11-12 01:28:24
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 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