Question

I am following the quickstart guide for boost::spirit, and I get this compiler warning when I include : "This header is deprecated. Please use: boost/spirit/include/classic_core.hpp" Should I be worried about this?

(quick start guide: http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/doc/quick_start.html , with full source of the program I am trying to compile here: http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/example/fundamental/number_list.cpp)

edit: Additionally, when I try to compile with the recommended classic_core.hpp and classic_push_back_actor.hpp headers, I get the following compiler errors:

test7.cpp: In function 'bool parse_numbers(const char*, __gnu_debug_def::vector<double, std::allocator<double> >&)':
test7.cpp:18: error: 'real_p' was not declared in this scope
test7.cpp:18: error: 'push_back_a' was not declared in this scope
test7.cpp:23: error: 'space_p' was not declared in this scope
test7.cpp:23: error: 'parse' was not declared in this scope
Was it helpful?

Solution

[EDIT:] The original answer is badly out of date; in particular the link is broken. The current version of Boost (since 2012-02-24) is 1.49.0.

The warning mentioned is a result of #include <boost/spirit.hpp> which is a deprecated header; however old examples on the web use this form. To get started, try the boost tutorials. Once you see the correct includes and namespaces, most old examples can easily be converted.

[OLD ANSWER:]

You must be using boost 1.39 or later (via SVN). This presentation should help:

In short, there's a brand new way of doing thing and these are the namespaces to use:

  • boost::spirit:qi (for the parser)
  • boost::spirit::karma (for the generator lib)

The official release is 1.40 so probably by that time the doc will be updated.

EDIT: the doc in the boost SVN repository is being worked on and probably reflect the new architecture in a more faithful manner.

OTHER TIPS

When you're including the classic headers the parsers are in the boost::spirit::classic namespace. Try:

using namespace boost::spirit::classic;

When a library indicates that a class/header/method/etc. is deprecated, it means that the maintainer of the library will most likely stop maintaining the functionality, and may remove it in the future. I would recommend to switch to the suggested header sooner than later, so save yourself from headaches in the future.

The new header may have a slightly different way of handling the feature, so you may need to make some code changes.

(I don't know much about boost, this is just a general comment)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top