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 following the example here: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html Everything works fine. The first time I click
I'm following several tutorials and references trying to get my kernel set up. I've
Hi I am quite new to php but i have been following some tutorials
I’m looking for some samples/tutorials/general pointers in doing either of the following. 1) Create
I have integrated NHibernate.Search into my web app by following tutorials from the following
I am new to Android development and have been following the tutorials available on
I am a newcomer to Silverlight and while I have been following some tutorials
I'm using the following tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html in order to create a map view and
I've been following this tutorial: http://developer.android.com/resources/tutorials/views/hello-mapview.html but in onTap mContext is throwing a NullPointerException..
I read some tutorials and came up with the following script to authenticate with

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.