Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4615774
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:53:16+00:00 2026-05-22T01:53:16+00:00

In file A.hpp, I have extern boost::signal<void (model::Bullet&, Point&, Point&, int)> signal_createBullet; and so

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:53:17+00:00Added an answer on May 22, 2026 at 1:53 am

    static void receiveSignalCreateBullet(const Bullet&, const Point&, const Point&, const int);

    Why parameters here are const? In signal declaration they are not const.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function in header file Class2.hpp of the form: class Class2{ void
I have this definition of the function in my class. The .hpp file: class
I have rand.cpp and rand.hpp file and have rand_unif() function. I have included rand.hpp
I have the following templated class, declared in an .hpp file with the implementation
In .hpp file I have template <SomeEnum E> class SomeClass { //many definitions class
Suppose I have a class with a method template: //file: X.h class X{ int
I have this file logger.hpp: #ifndef _LOGGER_HPP_ #define _LOGGER_HPP_ #include event.hpp // Class definitions
I have a class called A, which has its .cpp and .hpp files. It
I have a class which defines the following members in a header file (.hpp):
I have Foo.hpp and Foo.cpp, i'd like to define a virtual function virtual void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.