Hi! I'm using the "thread_safe_signals"-library in a Qt-Context. I have a file "foo.cpp" containing Qt-stuff which is processed by the moc before it compiles. foo.cpp:
#include "foo.h"
... Qt-stuff ...
foo.h:
#include "bar.h"
... Qt-declarations ..
bar.h:
#include
#include #include ...
Now the following happens: 1.) The Qt moc creates moc_foo.cpp based on foo.cpp 2.) everything compiles fine ("g++ (GCC) 4.1.0 (SUSE Linux)" using SCons on SUSE 10.1) 3.) The linking process fails with:
build/release/src/foo.os: In function `boost::signalslib::null_deleter(void const*)': /path_to_boost/include/boost/thread_safe_signals/connection.hpp:42: multiple definition of ` boost::signalslib::null_deleter(void const*)' build/release/src/bar.os:/path_to_boost/include/boost/thread_safe_signals/connection.hpp:42: first defined here build/release/src/foo_moc.os: In function `boost::signalslib::null_deleter(void const*)': /path_to_boost/include/boost/thread_safe_signals/connection.hpp:42: multiple definition of `boost::signalslib::null_deleter(void const*)' build/release/src/bar.os:/path_to_boost/include/boost/thread_safe_signals/connection.hpp:42: first defined here collect2: ld returned 1 exit status
Our workaround was to edit connection.hpp from: 42: > void null_deleter(const void*) {} to 42: > void null_deleter(const void*); and add to bar.cpp:
namespace boost { namespace signalslib { void null_deleter(const void*) {} } }
This works, but maybe there is a better solution to cope with this problem. Any ideas? Kindest regards Raimar Wagner