我正在遵循 boost::spirit 的快速入门指南,当我包含时收到此编译器警告:“此 header 已弃用。请使用:boost/spirit/include/classic_core.hpp” 我应该担心这个吗?
(快速入门指南:http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/doc/quick_start.html,以及我要在这里编译的程序的完整源代码:http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/example/fundamental/number_list.cpp)
编辑:此外,当我尝试使用推荐的 classic_core.hpp 和 classic_push_back_actor.hpp header 进行编译时,出现以下编译器错误:
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
最佳答案
[编辑:]原来的答案已经严重过时了;特别是链接断开了。 Boost 的当前版本(自 2012-02-24 起)是 1.49.0。
提到的警告是 #include <boost/spirit.hpp>
的结果这是一个已弃用的 header ;然而网络上的旧示例使用这种形式。要开始,请尝试 boost tutorials .一旦您看到正确的包含和命名空间,大多数旧示例都可以轻松转换。
[旧答案:]
您必须使用 boost 1.39 或更高版本(通过 SVN)。此演示文稿应该有助于:
简而言之,这是一种全新的做事方式,这些是要使用的命名空间:
-
boost::spirit:qi
(对于解析器) -
boost::spirit::karma
(对于生成器库)
官方版本是 1.40,所以到那时文档可能会更新。
编辑:the doc in the boost SVN repository正在开发中,并可能以更忠实的方式反射(reflect)新架构。
关于c++ - boost spirit header 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/924642/