
2 Jun
2008
2 Jun
'08
9:22 p.m.
#include <boost/test/unit_test.hpp> using namespace boost::unit_test; void free_test_function() { BOOST_CHECK(2 == 1); } test_suite* init_unit_test_suite( int, char* [] ) { framework::master_test_suite().p_name.value = "Unit test example 02"; framework::master_test_suite().add( BOOST_TEST_CASE( &free_test_function ), 2 ); } Im trying to build above program, but facing linking errors. Linker can not find main When I add #define BOOST_TEST_MAIN 1 before including unit-test.cpp, it gives me compilation error "redefinition of init_unit_test_suite" When I define both BOOST_TEST_DYN_LINK & BOOST_TEST_MAIN, then it build successfully but I get error "Test setup error: test tree is empty" Someone please help me solve it. :wq Pankaj