
On Jan 14, 2008, at 9:31 AM, Jens Seidel wrote:
$ g++ -DBOOST_TEST_DYN_LINK test.cpp -lboost_unit_test_framework /tmp/ccKcB2Ps.o: In function `main': test.cpp:(.text+0x3d4): undefined reference to `boost::unit_test::unit_test_main(bool (*)(), int, char**)' /usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib/ libboost_unit_test_framework.a(framework.o): In function `boost::unit_test::framework::init(int, char**)': (.text+0x6fa): undefined reference to `init_unit_test_suite(int, char**)' collect2: ld returned 1 exit status
I /worked around/ this issue by always defining a dummy init_unit_test_suite symbol (which was an idea and a contribution of Hubert Figuiere). This seems totally wrong to me but "It Gets The Job Done". I'm just sad that I have to write such kludge to satisfy the weird need of a library. Most of the lib I know which need to interact directly with `main' require you to invoke a function directly from within main. Qt is a great example, you must instantiate a QApplication and give it argc and argv. It's a very common idiom. Yet Boost.Test decided that it was a good idea to embed a `main' in a library (!). What if I want to link with two libraries that decided that it was their own right to define `main'? Come on, this is almost ridiculous and it seems that Gennadiy is not willing to make any effort to understand the problem. Gennadiy, don't take this remark as an attack against you, I have nothing against you, it's just that you don't seem to be inclined to understand the issue. -- Benoit Sigoure aka Tsuna EPITA Research and Development Laboratory