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 6606831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:26:16+00:00 2026-05-25T19:26:16+00:00

I haven’t been able to remove compile errors using boost::signals. Any idea would be

  • 0

I haven’t been able to remove compile errors using boost::signals. Any idea would be appreciated.

Since I’ve been porting a program that’s written 2 years ago adjusting to the current environment, I’m still new to boost::signals. The codes below are what I modified the original program to simplify for the question purpose.

I want a direct solution to my question. But besides that, because there are many questions regarding to boost::signals (but I’ve given up figuring out which one is the right/closest to my case), I’d give a vote to the ones that suggest in the answer area more proper titles of this question in order to make this a better archived question.

boostProve_Doc.h

#ifndef FC_H
#define FC_H

#include <vector>
#include "iostream"
#include "boost/signal.hpp"
typedef boost::signal<void()> PostUpdateSignal;
typedef PostUpdateSignal::slot_function_type PSlot;

class Doc {
public:
    Doc(uint width, uint height) {
        std::cout << "In constructor. width= " << width << ", height= "
                << height << std::endl;
    }
    ~Doc() {
        //Do ...
    }

    void connectPostUpdate(PSlot s) {
        sig.connect(s);
    }

protected:
    PostUpdateSignal sig;
};
#endif

boostProve_View.cpp:

#include <string>
#include <iostream>
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
#include <boost/bind.hpp>
#include <boostProve_Doc.h>

using namespace std;
class View {
public:
    View() {
        setupCrowd();
    }
    ~View() {
        //do something...
    }
private:
    Doc *crowd_;
    void setupCrowd() {
        crowd_->connectPostUpdate(&View::correctR);
    }
    void correctR() {
        // do something..
    }
};

int main(int argc, char** argv) {
    View c();
    return 0;
}

Error:

$ g++ boostProve_View.cpp -I . /usr/lib/libboost_signals.so
In file included from /usr/include/boost/function/detail/maybe_include.hpp:13,
                 from /usr/include/boost/function/detail/function_iterate.hpp:14,
                 from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:47,
                 from /usr/include/boost/function.hpp:64,
                 from /usr/include/boost/thread/future.hpp:20,
                 from /usr/include/boost/thread.hpp:24,
                 from boostProve_View.cpp:3:
/usr/include/boost/function/function_template.hpp: In member function ‘void boost::function0<R>::assign_to(Functor) [with Functor = void (View::*)(), R = void]’:
/usr/include/boost/function/function_template.hpp:722:   instantiated from ‘boost::function0<R>::function0(Functor, typename boost::enable_if_c<boost::type_traits::ice_not::value, int>::type) [with Functor = void (View::*)(), R = void]’
/usr/include/boost/function/function_template.hpp:1064:   instantiated from ‘boost::function<R()>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not::value, int>::type) [with Functor = void (View::*)(), R = void]’
boostProve_View.cpp:20:   instantiated from here
/usr/include/boost/function/function_template.hpp:903: error: no class template named ‘apply’ in ‘struct boost::detail::function::get_invoker0<boost::detail::function::member_ptr_tag>’
/usr/include/boost/function/function_template.hpp:913: error: too many initializers for ‘boost::detail::function::basic_vtable0<void>’
/usr/include/boost/function/function_template.hpp: In member function ‘bool boost::detail::function::basic_vtable0<R>::assign_to(F, boost::detail::function::function_buffer&) [with F = void (View::*)(), R = void]’:
/usr/include/boost/function/function_template.hpp:915:   instantiated from ‘void boost::function0<R>::assign_to(Functor) [with Functor = void (View::*)(), R = void]’
/usr/include/boost/function/function_template.hpp:722:   instantiated from ‘boost::function0<R>::function0(Functor, typename boost::enable_if_c<boost::type_traits::ice_not::value, int>::type) [with Functor = void (View::*)(), R = void]’
/usr/include/boost/function/function_template.hpp:1064:   instantiated from ‘boost::function<R()>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not::value, int>::type) [with Functor = void (View::*)(), R = void]’
boostProve_View.cpp:20:   instantiated from here
/usr/include/boost/function/function_template.hpp:492: error: no matching function for call to ‘boost::detail::function::basic_vtable0<void>::assign_to(void (View::*&)(), boost::detail::function::function_buffer&, boost::detail::function::basic_vtable0<R>::assign_to(F, boost::detail::function::function_buffer&) [with F = void (View::*)(), R = void]::tag)’

Environment: Ubuntu 10.10, g++ (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5


9/30/11 Update) Thanks to the suggestion, I solved the issue by doing this:

crowd_->connectPostUpdate(boost::bind(&View::correctR, this));
  • 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-25T19:26:16+00:00Added an answer on May 25, 2026 at 7:26 pm

    The problem is that your slot wants a function of type void (*)(), whereas you’re giving it an argument of type void (View::*)(). A member function pointer is not the same as a function pointer, unfortunately. One way you could fix this is to make correctR static, which would give it the correct signature. If that fails, you might want to investigate things such as Boost’s Bind library.

    See this part of the C++ FAQ Lite for more on pointers to member functions.

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

Sidebar

Related Questions

I haven't been able to find a very good way of getting 10 random
I haven't been able to find authorative explanations, microformats or guidelines for the following,
I haven't been able to find what these Xcode icons mean. Some you can
I haven't been able to solve this prolog exercise. I was hoping someone here
I haven't been able to find a straight answer on this. Can anyone tell
I have looked around the internet but haven't been able to find a working
I haven't been able to see anything in the documentation which speaks to my
Haven't fired up reflector to look at the difference but would one expect to
Haven't done ASP.NET development since VS 2003, so I'd like to save some time
I haven't used C++ since college. Even though I've wanted to I haven't needed

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.