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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:56:09+00:00 2026-06-15T19:56:09+00:00

Ok.. First of all, I have to say I’m using BOOST with its source

  • 0

Ok.. First of all, I have to say I’m using BOOST with its source (I have to).
I’m both a BOOST and a C++ newbie, but I’m not new to coding (I’m rather used to managed languages). I met this problem in a somewhat large project, then I reproduced it in this little code snippet I’m presenting here:

#include <boost/thread.hpp>

void foo(int bar) {
    printf("Chu %d!",bar);
}

int main() {
    boost::thread_attributes attrs;

    boost::thread causeTrouble(attrs,foo,42); // <-- Probably problematic line
    causeTrouble.join();
}

According to BOOST 1.52.0 Documentation this snippet should both compile and run fine; however, it gives me a weird compilation problem in a BOOST library header file (no other errors or warnings are present):

<boost_path>/bind/bind.hpp:313: error: no match for call to '(boost::thread_attributes) (void (*&)(int), int&)

To me, it looks like there’s no actual boost::thread(boost::thread_attributes,F f) constructor, even if it should be according to the previously linked documentation.
Anyway, what’s funny is that both the following lines do compile fine:

boost::thread noTrouble(attrs,foo);

and

boost::thread noTroubleEither(foo,42);

Even if I thoroughly searched StackOverflow and the rest of the Internet, I don’t know where to turn my head 🙁 In fact this is the first time I’m forced to actually ask a new question. Help!

  • 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-06-15T19:56:11+00:00Added an answer on June 15, 2026 at 7:56 pm

    You say,

    it looks like there’s no actual boost::thread(boost::thread_attributes,F f)

    That’s not the constructor you’re trying to call though. You’re calling boost::thread(attrs, foo, 42). Based off the link, it looks like there’s no boost::thread(boost::attributes, F, Args) constructor implemented, hence the complaint.

    Try first using boost::bind explicitly to bind the 42 into foo and the starting the thread on the bound function object.

    Something like this:

    boost::function< void > f = boost::bind( foo, 42 );
    boost::thread( attrs, f )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all I have to say I am new to iOS development. My
First of all, this is not homework! :) Say I have an NSString: the?or?
First of all, I have to say, I'm new to mocking. So maybe I'm
First of all, I have to say I'm quite new to Java. I need
First of all I'm quite new to Springframwork. Let's say I have a controller
First of all, I have to say that I'm going to talk about System.ComponentModel.Component
First of all i want to say that i have searched each and every
First of all I have searched many times in this forum but none is
First of all i have to clear few things 1.This is not spam group
First of all i have to say this is a strange one: Client has

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.