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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:04:05+00:00 2026-06-01T11:04:05+00:00

I have the following code, in which Boost.Local uses a function callback to load

  • 0

I have the following code, in which Boost.Local uses a function callback to load a mo file. The function is called findMo for me, and I’m trying to bind it to an object so I can retain the side effects I put in private members of moFinder.

class moFinder
{
  public:
    moFinder(string const& wantedFormat)
    : format(wantedFormat)
    {
      // ...
    }

    std::vector<char> findMo(std::string const& filePath, std::string const& encoding)
    {
      // ...
    }
};

std::locale createLocale(string const& name, string const& customTranslation,
  string const& path, string const& domain, string const& pathFormat)
{
  // ...

  namespace blg = boost::locale::gnu_gettext;
  blg::messages_info info;
  info.paths.push_back(path);
  info.domains.push_back(blg::messages_info::domain(domain));

  moFinder finder(pathFormat);

  blg::messages_info::callback_type callbackFunc;
  callbackFunc = boost::bind(moFinder::findMo, boost::ref(finder));

  info.callback = callbackFunc;

  // ...
}

When compiling I get the following error:

error: invalid use of non-static member function ‘std::vector moFinder::findMo(const std::string&, const std::string&)’

At the line where I call boost::bind.

What am I doing to deserve 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-06-01T11:04:06+00:00Added an answer on June 1, 2026 at 11:04 am

    You are missing the address of operator before the member address: &moFinder::findMo. Additionally you will need to use boost::mem_fn to wrap the member function into a function object and you are missing the placeholders. All-in-all:

    boost::bind(boost::mem_fn(&moFinder::findMo,), boost::ref(finder), _1, _2);
                                                   // or &finder 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code which i m trying to compile: #include <boost/filesystem/convenience.hpp> #include
I'm trying to use opengl in C#. I have following code which fails with
I have the following code which reads in the follow file, append a \r\n
I have the following code which re-uses a CookieContainer which logs in on the
I have the following code (which largely follows the first example here: http://www.boost.org/doc/libs/1_42_0/libs/multi_index/doc/examples.html )).
I have just been working with boost::bind and boost::function and noticed the following behaviour
I have following code which works for radio buttons but need to be changed
I want to know is below code correct ? I have following code which
I have following Code Block Which I tried to optimize in the Optimized section
I have the following code which works just fine when the method is POST,

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.