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

The Archive Base Latest Questions

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

Although there is at least one similar question , I still ask mine since

  • 0

Although there is at least one similar question, I still ask mine since that one hasn’t got solved and seems more complicated. I’m trying to simplify mine.

I have a .cpp file that uses .h as below, and compiling these sheds error as follows. Any idea is appreciated. Note that codes are simplified in order to minimally show the problematic parts only.

FC_boost_prove.h:

#ifndef FC_H
#define FC_H

#include <vector>
#include "iostream"

#include "boost/signal.hpp"
#include "boost/bind.hpp"
#include <boost/random.hpp>

typedef boost::signal0<void()> PreUpdateSignal;
typedef PreUpdateSignal::slot_function_type PreUpdateSlot;
typedef boost::signal0<void()> PostUpdateSignal;
typedef PostUpdateSignal::slot_function_type PostUpdateSlot;

class FC {
public:
    FC(uint width, uint height) {
        std::cout << "In constructor." << std::endl;
    }
    ~FC() {
        //Do ...
    }
    void connectPreUpdate(PreUpdateSlot s) {
        preUpdateSignal_.connect(s);
    }
    void connectPostUpdate(PostUpdateSlot s) {
        postUpdateSignal_.connect(s);
    }

protected:
    PreUpdateSignal preUpdateSignal_;
    PostUpdateSignal postUpdateSignal_;
};
#endif

FC_boost_prove.cpp:

#include <iostream>
#include <string>
#include "FC_boost_prove.h"

int main() {
    std::cout << "test." << std::endl;
}

Compile error:

$ g++ FC_boost_prove.cpp 
In file included from /usr/include/boost/signals/signal_template.hpp:22,
                 from /usr/include/boost/signals/signal0.hpp:24,
                 from /usr/include/boost/signal.hpp:19,
                 from FC_boost_prove.h:7,
                 from FC_boost_prove.cpp:3:
/usr/include/boost/last_value.hpp: In instantiation of ‘boost::last_value<void()>’:
/usr/include/boost/signals/signal_template.hpp:178:   instantiated from ‘boost::signal0<void(), boost::last_value<void()>, int, std::less<int>, boost::function0<void()> >’
FC_boost_prove.h:12:   instantiated from here
/usr/include/boost/last_value.hpp:22: error: function returning a function
In file included from /usr/include/boost/signals/signal0.hpp:24,
                 from /usr/include/boost/signal.hpp:19,
                 from FC_boost_prove.h:7,
                 from FC_boost_prove.cpp:3:
/usr/include/boost/signals/signal_template.hpp: In instantiation of ‘boost::signal0<void(), boost::last_value<void()>, int, std::less<int>, boost::function0<void()> >’:
FC_boost_prove.h:12:   instantiated from here
/usr/include/boost/signals/signal_template.hpp:330: error: function returning a function
/usr/include/boost/signals/signal_template.hpp:370: error: function returning a function
In file included from /usr/include/boost/function/detail/maybe_include.hpp:13,
                 from /usr/include/boost/function/function0.hpp:11,
                 from /usr/include/boost/signals/signal_template.hpp:38,
                 from /usr/include/boost/signals/signal0.hpp:24,
                 from /usr/include/boost/signal.hpp:19,
                 from FC_boost_prove.h:7,
                 from FC_boost_prove.cpp:3:
/usr/include/boost/function/function_template.hpp: In instantiation of ‘boost::function0<void()>’:
FC_boost_prove.h:24:   instantiated from here
/usr/include/boost/function/function_template.hpp:1006: error: function returning a function
/usr/include/boost/function/function_template.hpp: In instantiation of ‘boost::detail::function::basic_vtable0<void()>’:
/usr/include/boost/function/function_template.hpp:856:   instantiated from ‘void boost::function0<R>::clear() [with R = void()]’
/usr/include/boost/function/function_template.hpp:752:   instantiated from ‘boost::function0<R>::~function0() [with R = void()]’
/usr/include/boost/signals/slot.hpp:105:   instantiated from here
/usr/include/boost/function/function_template.hpp:486: error: function returning a function
/usr/include/boost/function/function_template.hpp:643: error: function returning a function

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

  • 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:05:10+00:00Added an answer on May 25, 2026 at 7:05 pm

    Why are you specifying boost::signal0<>? The signalN templates are for deficient compilers that can’t properly parse function signatures.

    Either use signal and specify the function signature, as recommended for modern compilers:

    typedef boost::signal<void()> PreUpdateSignal;
    typedef boost::signal<void()> PostUpdateSignal;
    

    or use signalN and specify the return type (and every argument type) explicitly, as needed for deficient compilers:

    typedef boost::signal0<void> PreUpdateSignal;
    typedef boost::signal0<void> PostUpdateSignal;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although appengine already is schema-less, there still need to define the entities that needed
I'm almost finished with my project, although there is one thing that I can't
Although there are a lot of posts about .net config files, I believe that
Although there are some similar questions I’m having difficulties finding an answer on how
I'm building a site using CodeIgniter that largely consists of static content (although there
I couldn't find a duplicate for this question for Java, although there are a
Although the question title appears a bit subjective I am sure there is not
OK, there is at least one, arguably more, PC based IDE for developing Android
It seems like a bit of an omission that there's no easy way to
I was unable to find a similar question on Stackoverflow, although I am sure

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.