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" wrote in message news:20071112062824.30248.qmail@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@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
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@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users