Boost logo

Boost Users :

Subject: Re: [Boost-users] [spirit] Cannot find assig_a in spirit 2.1
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-09-25 16:37:34


On Fri, Sep 25, 2009 at 1:58 PM, Christian Henning <chhenning_at_[hidden]> wrote:
>>
>> Also, I just noticed this is not on the Spirit mailing list.  You
>> should post Spirit related questions to the Spirit mailing list, will
>> get more and faster responses.
>
> Response time was very good. ;-)

That is because I happened to be perusing both lists at the time, that
is not that common. :)

On Fri, Sep 25, 2009 at 1:57 PM, Christian Henning <chhenning_at_[hidden]> wrote:
> Thanks for the quick reply. This looks very interesting. But the
> following snippets bombs on my machine using VS2005.
>
> #include <boost\algorithm\string.hpp>
> #include <boost\spirit\include\qi.hpp>
>
> namespace qi = boost::spirit::qi;
> namespace ascii = boost::spirit::qi::ascii;
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> std::string number( "123" );
>
> int i;
> qi::parse( number.begin()
> , number.end()
> , qi::int_
> , ascii::blank
> , i
> );
>
> return 0;
> }

I compiled your example in Visual Studio 2005, and got these errors:
1>s:\tmp\testing\parser\spirit_testing\main.cpp(5) : error C2039:
'ascii' : is not a member of 'boost::spirit::qi'
1>s:\tmp\testing\parser\spirit_testing\main.cpp(5) : error C2878:
'ascii' : a namespace or class of this name does not exist
1>s:\tmp\testing\parser\spirit_testing\main.cpp(7) : error C2061:
syntax error : identifier '_TCHAR'
1>s:\tmp\testing\parser\spirit_testing\main.cpp(15) : error C2653:
'ascii' : is not a class or namespace name
1>s:\tmp\testing\parser\spirit_testing\main.cpp(16) : error C2065:
'blank' : undeclared identifier

First of all, ascii is not in qi, it is in spirit, so I fix that and
change your _TCHAR to just char and _tmain to just main (you are not
including windows.h after all) and change parse to phrase_parse (since
you are using a skipper, use just parse if you are not using a
skipper, basically do like my above example shown) and it compiles and
runs fine here and does stuff i with 123.
This was the fixed code:

#include <boost\algorithm\string.hpp>
#include <boost\spirit\include\qi.hpp>

namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;

int _tmain(int argc, char* argv[])
{
        std::string number( "123" );

        int i;
        qi::phrase_parse( number.begin()
                , number.end()
                , qi::int_
                , ascii::blank
                , i
                );

        return 0;
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net