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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:05:41+00:00 2026-05-20T22:05:41+00:00

I was following the tutorials in the Spirit documentation, and I’m stuck here: #include

  • 0

I was following the tutorials in the Spirit documentation, and I’m stuck here:

#include <iostream>
#include <string>
#include <boost/spirit/include/qi.hpp>

template <typename Iterator>
bool parse_numbers(Iterator first, Iterator last, double &sum)
{
namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;
namespace ph = boost::phoenix;

bool r = qi::phrase_parse(
    first,
    last,
    // begin grammar
    (
        qi::double_[ph::ref(sum) = qi::_1] >> *(',' >> qi::double_[ph::ref(sum) += qi::_1])
    )
    // end grammar
    , ascii::space
);

if (first != last)
    return false;
return true;
}

int main(int argc, char **argv)
{
std::string str = argv[1];
double sum;
bool result = parse_numbers(str.begin(), str.end(), sum);
if (result) {
    std::cout << "Sum: " << sum << std::endl;
    return 0;
}
std::cout << "Invalid Input" << std::endl;
return 1;
}

When I compile it, it shows this error:

$ c++ spirit-test.c++ 
spirit-test.c++: In function ‘bool parse_numbers(Iterator, Iterator, double&) [with Iterator = __gnu_cxx::__normal_iterator<char*, std::basic_string<char> >]’:
spirit-test.c++:32:57:   instantiated from here
spirit-test.c++:21:2: error: no match for ‘operator+=’ in ‘boost::phoenix::ref [with T = double](((double&)((double*)sum))) += boost::spirit::_1’
spirit-test.c++:21:2: error: no match for ‘operator=’ in ‘boost::phoenix::ref [with T = double](((double&)((double*)sum))) = boost::spirit::_1’
/usr/include/boost/spirit/home/phoenix/core/actor.hpp:143:16: note: candidate is: boost::phoenix::actor<Eval>& boost::phoenix::actor<Eval>::operator=(const boost::phoenix::actor<Eval>&) [with Eval = boost::phoenix::reference<double>, boost::phoenix::actor<Eval> = boost::phoenix::actor<boost::phoenix::reference<double> >]

What’s wrong?

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

    Add this:

    #include <boost/spirit/include/phoenix_core.hpp>
    #include <boost/spirit/include/phoenix_operator.hpp>
    

    to your includes and it should work.

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

Sidebar

Related Questions

I'm going through the Boost Spirit (and Boost Fusion) tutorials (version 1.48.0). I've been
I'm attempting to following the tutorials found here: http://www.ifadey.com/2010/06/crud-using-jquery-and-codeigniter/ My code is updated to
I'm following some tutorials by Bartosz Milewski here which I find very useful. However,
I have a problem that comes from me following tutorials without really understanding what
I am following some tutorials and came up with the following code: // rendering.cpp
I have been following several tutorials that have made me succeed in getting information
I've been following the tutorials over at http://www3.ntu.edu.sg/home/ehchua/programming/android/Android_3D.html and I've encountered a problem. I've
I have implemented a Database in my project and following several tutorials, have been
I'm learning masm32, following some tutorials. In one tutorial: http://win32assembly.online.fr/tut3.html there is stated: LOCAL
I'm trying to create my first AVD for Android 4.0.3 following the tutorials ,

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.