[plugin] problem with headers in different objects

hi all, currently it's not possible to include boost/plugin.hpp or boost/plugin/virtual_constructors.hpp from different object files with gcc-3.4.6 including plugin.hpp from two object files: tim@laptop ~/sandbox $ g++ main.cpp t1.o t2.o t2.o: In function `boost::dynamic_visitor_base::~dynamic_visitor_base()': t1.cpp:(.text+0x0): multiple definition of `boost::dynamic_visitor_base::~dynami c_visitor_base()' t1.o:t1.cpp:(.text+0x0): first defined here t2.o: In function `boost::dynamic_visitor_base::~dynamic_visitor_base()': t1.cpp:(.text+0x28): multiple definition of `boost::dynamic_visitor_base::~dynam ic_visitor_base()' t1.o:t1.cpp:(.text+0x28): first defined here t2.o: In function `boost::dynamic_visitor_base::~dynamic_visitor_base()': t1.cpp:(.text+0x50): multiple definition of `boost::dynamic_visitor_base::~dynam ic_visitor_base()' t1.o:t1.cpp:(.text+0x50): first defined here t2.o:(.bss+0x0): multiple definition of `(anonymous namespace)::_1' t1.o:(.bss+0x0): first defined here t2.o:(.bss+0x1): multiple definition of `(anonymous namespace)::_2' t1.o:(.bss+0x1): first defined here t2.o:(.bss+0x2): multiple definition of `(anonymous namespace)::_3' t1.o:(.bss+0x2): first defined here t2.o:(.bss+0x3): multiple definition of `(anonymous namespace)::_4' t1.o:(.bss+0x3): first defined here t2.o:(.bss+0x4): multiple definition of `(anonymous namespace)::_5' t1.o:(.bss+0x4): first defined here t2.o:(.bss+0x5): multiple definition of `(anonymous namespace)::_6' t1.o:(.bss+0x5): first defined here t2.o:(.bss+0x6): multiple definition of `(anonymous namespace)::_7' t1.o:(.bss+0x6): first defined here t2.o:(.bss+0x7): multiple definition of `(anonymous namespace)::_8' t1.o:(.bss+0x7): first defined here t2.o:(.bss+0x8): multiple definition of `(anonymous namespace)::_9' t1.o:(.bss+0x8): first defined here collect2: ld returned 1 exit status t1.cpp & t2.cpp contain: #include "boost/plugin.hpp" main.cpp contains: int main(){return 0;} similar things happen with boost/plugin/virtual_constructors.hpp ... not sure, if it's a but in the library, or a compiler bug ... cheers ... tim -- TimBlechmann@gmx.de ICQ: 96771783 http://www.mokabar.tk You can play a shoestring if you're sincere John Coltrane

David Abrahams wrote:
That's a boost sandbox library that Hartmut and I work on, at times. I had no idea anybody would try to use it ;-) Tim, to answer you question, the first problem is that boost-sandbox/visitor/dynamic_visitor_base.hpp has a bug -- it define non-inline function. I've just fixed that. But: the plugin library does not include that header, you must be including it yourself... As for multiple definition of `(anonymous namespace)::_1', I've no idea where it comes from. I've tried the testcase you've described and got no link error. Can you provide: 1. Self-contained example that produces the error (zipped sources) 2. The version of Boost you have (CVS version is recommended) 3. Your compiler Maybe this will help to fix the problem. Thanks, Volodya

sorry, that i didn't respond earlier, i'm a posting only member, so please cc the answer to me ...
Excuse me? There are no such files in any Boost release I'm aware of, nor in the CVS head. Did I miss something?
sorry, didn't mention, that it's part of the sandbox ...
just try: gcc -H -c -I ../../../ application.cpp 2>&1 |grep dynamic_visitor_base it is included by the any.hpp
odd, i can't reproduce it either ... might have been a /usr/include vs boost-sandbox name clash ... anyway, today i figured out, i can't dlopen a shared library containing a BOOST_PLUGIN_EXPORT macro ... will try to strip down a test case and post it to the list ... thanks, tim -- TimBlechmann@gmx.de ICQ: 96771783 http://www.mokabar.tk Your mind will answer most questions if you learn to relax and wait for the answer. William S. Burroughs
participants (3)
-
David Abrahams
-
Tim Blechmann
-
Vladimir Prus