Boost logo

Boost Users :

From: Perepelitsa Roman (romka_at_[hidden])
Date: 2005-12-27 05:02:08


>> When I try to link a test suite I get this:
>>
>> ld: multiple definitions of symbol boost::test_tools::(anonymous
>> namespace)::check_is_close
>> mspathCEntry_test.o definition of boost::test_tools::(anonymous
>> namespace)::check_is_close in section (__DATA,__data)
>> ModelBuilder_test.o definition of boost::test_tools::(anonymous
>> namespace)::check_is_close in section (__DATA,__data)
>> ld: multiple definitions of symbol boost::test_tools::(anonymous
>> namespace)::check_is_small
>> mspathCEntry_test.o definition of boost::test_tools::(anonymous
>> namespace)::check_is_small in section (__DATA,__data)
>> ModelBuilder_test.o definition of boost::test_tools::(anonymous
>> namespace)::check_is_small in section (__DATA,__data)
>> LinearProduct_test.o definition of boost::test_tools::(anonymous
>> namespace)::check_is_close in section (__DATA,__data)
>> LinearProduct_test.o definition of boost::test_tools::(anonymous
>> namespace)::check_is_small in section (__DATA,__data)
>> .....
>>
>> This is with boost 1.33 on Darwin/OS-X. The same code was building OK
>> with the 1.31 libraries (and 1.32 on linux, I think). I'm using libtool.
>> Here's the makefile

> I remember seeing similar report recently. As it clear from error message
> linker complains about multiple definitions for symbols in anonymous
> namespace. This looks like compiler bug. If you know any workarounds please
> share them with us.

> Gennadiy

I had the same problem with vc 7.1. If you add 'static' to all
variables definitions in anonymous namespaces it works fine.

For example instead of
namespace {
check_is_close_t check_is_close;
}

You can write
namespace {
static check_is_close_t check_is_close; // note 'static' keyword
}

Best regards,
Perepelitsa Roman.


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