Simple string parser in boost::spirit::x3 not working
Clash Royale CLAN TAG #URR8PPP Simple string parser in boost::spirit::x3 not working For learning purposes I'm trying to write a simple parser that accepts a string literal and puts it in a custom struct using the x3 library from boost. However, the following minimal example which is adapted from the example here does not compile. #include <iostream> #include <boost/spirit/home/x3.hpp> #include <boost/fusion/include/adapt_struct.hpp> #include <string> namespace x3 = boost::spirit::x3; namespace ast struct Symbol std::string val; ; BOOST_FUSION_ADAPT_STRUCT( ast::Symbol, val ) namespace parser x3::string("qwe"); BOOST_SPIRIT_DEFINE( symbol ); int main(int argc, char** argv) std::string input = "asd"; if (argc > 1) input = argv[1]; std::string::const_iterator begin = input.begin(); std::string::const_iterator end = input.end(); ast::Symbol sym; bool success = x3::phrase_parse(begin, end, parser::symbol, x3::ascii::space, ...