In file A.hpp, I have
extern boost::signal<void (model::Bullet&, Point&, Point&, int)> signal_createBullet;
and so in file A.cpp, I have
boost::signal<void (model::Bullet&, Point&, Point&, int)> signal_createBullet;
In file B.hpp, I have a class Entities that has a static member function receiveSignalCreateBullet that I want to connect with signal_createBullet, like so: (namespaces omitted for brevity)
class Entities
{
Entities()
{
signal_createBullet.connect(&receiveSignalCreateBullet);
}
public:
static void receiveSignalCreateBullet(const Bullet&, const Point&, const Point&, const int);
};
inline static void receiveSignalCreateBullet(...) { ... }
and finally in file C.cpp, I use signal_createBullet like this:
signal_createBullet(bullet, pos, bulletVector, count);
A and B compile successfully (using g++), but C fails with this error message:
In member function ‘virtual void thrl::model::SingleStream::shoot(const thrl::utl::Point&, const thrl::utl::Point&, const thrl::utl::Point&) const’:
src/Shot.cpp:25: error: no match for call to ‘(boost::signal4<void, thrl::model::Bullet&, thrl::utl::Point&, thrl::utl::Point&, int, boost::last_value<void>, int, std::less<int>, boost::function4<void, thrl::model::Bullet&, thrl::utl::Point&, thrl::utl::Point&, int> >) (const thrl::model::Bullet&, const thrl::utl::Point&, thrl::utl::Point&, int&)’
/usr/local/include/boost/signals/signal_template.hpp:330: note: candidates are: typename boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::result_type boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1, T2, T3, T4) [with R = void, T1 = thrl::model::Bullet&, T2 = thrl::utl::Point&, T3 = thrl::utl::Point&, T4 = int, Combiner = boost::last_value<void>, Group = int, GroupCompare = std::less<int>, SlotFunction = boost::function4<void, thrl::model::Bullet&, thrl::utl::Point&, thrl::utl::Point&, int>]
/usr/local/include/boost/signals/signal_template.hpp:370: note: typename boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::result_type boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1, T2, T3, T4) const [with R = void, T1 = thrl::model::Bullet&, T2 = thrl::utl::Point&, T3 = thrl::utl::Point&, T4 = int, Combiner = boost::last_value<void>, Group = int, GroupCompare = std::less<int>, SlotFunction = boost::function4<void, thrl::model::Bullet&, thrl::utl::Point&, thrl::utl::Point&, int>]
While trying to figure this out, I formatted my call and the first candidate in the error message to more easily compare them:
// my call
‘(
boost::signal
<
void
(
thrl::model::Bullet&,
thrl::utl::Point&,
thrl::utl::Point&,
int
),
boost::last_value<void>,
int,
std::less<int>,
boost::function
<
void
(
thrl::model::Bullet&,
thrl::utl::Point&,
thrl::utl::Point&,
int
)
>
>
)
(
const thrl::model::Bullet&,
const thrl::utl::Point&,
thrl::utl::Point&,
int&
)’
// what g++ expects
typename boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::result_type
boost::signal4<R, T1, T2, T3, T4, Combiner, Group, GroupCompare, SlotFunction>::operator()(T1, T2, T3, T4)
[ with
R = void,
T1 = thrl::model::Bullet&,
T2 = thrl::utl::Point&,
T3 = thrl::utl::Point&,
T4 = int,
Combiner = boost::last_value<void>,
Group = int,
GroupCompare = std::less<int>,
SlotFunction = boost::function
<
void
(
thrl::model::Bullet&,
thrl::utl::Point&,
thrl::utl::Point&,
int
)
>
]
// the second candidate is the same as the first, except that it's const
Besides the fact that the candidate uses the 'Portable' syntax, (and no, switching my code to use the Portable style makes no difference) I see no difference between the two calls except that the last thing in my call is int& where the candidate has a int. I tried removing the int parameter from the signal to see if that was the problem, and it wasn't.
Anyone see why I'm getting this error?