[thread_safe_signals] Qt/MOC Linker problem with header-only thread_safe_signals-library
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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 29 January 2008 09:40 am, raimar wagner wrote:
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?
It should be declared inline, but it is already so in the latest release from 2008-01-11. - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHn5C85vihyNWuA4URAlJgAJ9IKAGvGOtDKSVwvNk+zQ6oZVgIvwCfaq81 aD/07DTRMoL+TEeRZx5u5A4= =JUJP -----END PGP SIGNATURE-----
participants (2)
-
Frank Mori Hess
-
raimar wagner