I am having a linking issue with Boost.Test on my Mac OS X 10.5.
Consider the following example:
#define BOOST_TEST_DYN_LINK
#include
void test() { }
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[])
{
boost::unit_test::test_suite* ts = BOOST_TEST_SUITE("test suite");
ts->add(BOOST_TEST_CASE(&test));
boost::unit_test::framework::master_test_suite().add(ts);
return 0;
}
This does not compile with the following command:
g++ test.cc -L/opt/local/lib -lboost_unit_test_framework-mt
I am getting the following linker error:
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
It works, however, using the automatic test module definition, e.g.
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE foo
#include
and works also when I remove BOOST_TEST_DYN_LINK and compile the program
with the static library:
g++ test.cc /opt/local/lib/libboost_unit_test_framework-mt.a
But I can't get the first example code above to link. Does anyone see
the problem lurking?
Matthias
--
Matthias Vallentin
vallentin@icsi.berkeley.edu
http://www.icir.org/matthias