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

  • Home
  • SEARCH
  • 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 6191715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:48:53+00:00 2026-05-24T02:48:53+00:00

I’m having a bit of an odd problem while trying to compile some code

  • 0

I’m having a bit of an odd problem while trying to compile some code using the latest version of MinGW (GCC 4.5.2) under Windows Vista Home Premium 64-bit. While compiling this file, I get a message that “cc1plus.exe has stopped working” and the compilation fails with no error message. I have attempted to strip the file down to the absolute bare minimum that still produces the problem:

#include <boost/spirit/include/classic_file_iterator.hpp>
#include <boost/spirit/include/classic_position_iterator.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <boost/spirit/include/qi.hpp>
#include <vector>

#define BOOST_SPIRIT_AUTO(domain_, name, expr)                                  \
    typedef boost::proto::result_of::                                           \
        deep_copy<BOOST_TYPEOF(expr)>::type name##_expr_type;                   \
    BOOST_SPIRIT_ASSERT_MATCH(                                                  \
        boost::spirit::domain_::domain, name##_expr_type);                      \
    BOOST_AUTO(name, boost::proto::deep_copy(expr));                            \

using namespace std;

//This structure is used to determine the situation in which a certain tile sprite is used.
struct TileCase {
    //A vector of bit fields for which adjacent tiles which must be filled.
    vector<unsigned> filled;

    //A vector of bit fields for which adjacent tiles are optionally filled.
    vector<unsigned> optionalFilled;

    TileCase() :    filled(0),
                    optionalFilled(0){}
};

//Adapt the TileCase struct to a Fusion tuple.
BOOST_FUSION_ADAPT_STRUCT (
    TileCase,
    (std::vector<unsigned>, filled)
    (std::vector<unsigned>, optionalFilled)
)

namespace qi = boost::spirit::qi;
namespace phoenix = boost::phoenix;
namespace ascii = boost::spirit::ascii;
using phoenix::function;
using ascii::space;
using ascii::char_;
using qi::eol;

//A skipper rule for comments.
BOOST_SPIRIT_AUTO(qi, comment,  ("/*" >> *(char_ - "*/") >> "*/")
                                | ascii::space
                                | ("//" >> *(char_ - eol) >> eol)
                                );

//The Spirit error handler.
struct error_handler_ {
    template<typename, typename, typename>
    struct result { typedef void type; };

    template <typename Iterator>
    void operator()(
        qi::info const& what,
        Iterator err_pos, Iterator last) const
    {
        //Get the line position.
        boost::spirit::classic::file_position_base<string> const& pos = err_pos.get_position();

        //Throw an error.
        stringstream error;
        error << "Error! Expecting "
              << what
              << " at line "
              << pos.line
              << ", column "
              << pos.column
              << "!";
        throw(runtime_error(error.str()));
    }
};

function<error_handler_> const error_handler = error_handler_();

//The Spirit grammar for parsing tile data.
template<typename Iterator>
struct tileData : qi::grammar<Iterator, vector<TileCase>(), comment_expr_type> {
    //The rule called when the parsing starts.
    qi::rule<Iterator, vector<TileCase>(), comment_expr_type> start;

    //The rule for parsing a single tile case.
    qi::rule<Iterator, TileCase(), qi::locals<unsigned>, comment_expr_type> tile;

    //The rule which parses yes/no/either bitflag blocks.
    //Takes two references to unsigned, the first being the yes/no flag and the second being the optional flag.
    qi::rule<Iterator, void(unsigned&, unsigned&), qi::locals<unsigned>, comment_expr_type> condBlock;

    tileData() : tileData::base_type(start) {
        using qi::eps;
        using qi::lit;
        using qi::on_error;
        using qi::fail;
        using qi::uint_;
        using phoenix::at_c;
        using phoenix::push_back;
        using phoenix::resize;
        using namespace qi::labels;

        start = *tile[push_back(_val, _1)];

        tile =
            //Parse the filled definition.
            lit("filled")

        >   '('
            //Parse the generation to check for fills.
        >   uint_
            [
                _a = _1,
                resize(at_c<0>(_val), _1 + 1),
                resize(at_c<1>(_val), _1 + 1)
            ]
        >   ')'
            //Opening curly bracket for filled definition.
        >   '{'
            //The condition block.
        >   condBlock
            (
                //This one goes to filled[_a],
                (at_c<0>(_val))[_a],
                //and optionalFilled[_a].
                (at_c<1>(_val))[_a]
            )
            //Closing curly bracket for filled definition.
        >   '}'
        ;

        condBlock =
            eps
            [_a = 1]
        >>
            (
            *   (
                    (
                        +lit('+')
                        [_r1 += _a, _a *= 2]
                    )
                |
                    (
                        +lit('*')
                        [_r2 += _a, _a *= 2]
                    )
                |
                    (
                        +lit('-')
                        [_a *= 2]
                    )
                )
            )
        ;

        on_error<fail>
        (
            start,
            error_handler(_4, _3, _2)
        );
    }
};


int main() {
    try {
        //Set up the file iterator.
        typedef char char_type;
        typedef boost::spirit::classic::file_iterator<char_type> iterator_type;

        //Open the file.
        iterator_type first("Test.txt");

        //Make sure the file is open.
        if (!first) throw(runtime_error("Failed to open file!"));

        //Find the end of the file.
        iterator_type last = first.make_end();

        //Wrap the file iterator with a position iterator.
        typedef boost::spirit::classic::position_iterator2<iterator_type> pos_iterator_type;
        typedef tileData<pos_iterator_type> tileData;
        pos_iterator_type pos_first(first, last, "Test.txt");
        pos_iterator_type pos_last;

        //Prepare parsing information.
        tileData tileData_parser;
        vector<TileCase> cases;

        //Parse the file.
        if (phrase_parse(pos_first, pos_last, tileData_parser, comment, cases) && pos_first == pos_last) {
            //Do something...
        }
    }
    catch (const exception& e) {
        cerr << "Exception while reading file:\n" << e.what() << endl;
        return 1;
    }

    return 0;
}

In this stripped-down version, the compiler only crashes if debugging symbols (-g) are enabled. However, with the full version of the file, it crashes regardless. As well, if a portion of the Spirit code is removed (such as the error handler, or the comment skipper), it also compiles correctly. This suggests to me that the compiler is running out of memory, but I’m not entirely sure how to fix it.

I have tried building directly from command-line as well as from within Code::Blocks, but cc1plus still crashes. The only compiler flag I have enabled is -g. I have double-checked that I only have one installation of MinGW, and I have tried re-installing it, but the problem persists. What would be causing this to happen?

  • 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-24T02:48:54+00:00Added an answer on May 24, 2026 at 2:48 am

    This is a known problem with gcc/MingW, but I don’t know what the status is (whether it has been reproted at all, etc.) Somebody on the Spirit mailing list proposed a patch increasing the default stack size for cc1plus.exe, reportedly fixing the problem. I have not tried myself, though.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker

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.