不推荐使用 boostspirit 标头

发布于 2024-07-21 22:24:44 字数 1102 浏览 4 评论 0原文

我正在遵循 boost::spirit 的快速入门指南,当我包含以下内容时,我收到此编译器警告:“此标头已弃用。请使用: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 标头进行编译时,出现以下编译器错误:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

掩饰不了的爱 2024-07-28 22:24:44

[编辑:]原来的答案已经严重过时了; 特别是链接已损坏。 Boost 的当前版本(自 2012 年 2 月 24 日起)为 1.49.0。

提到的警告是 #include 的结果,它是一个已弃用的标头; 然而网络上的老例子使用这种形式。 要开始使用,请尝试 增强教程。 一旦您看到正确的包含和命名空间,大多数旧示例都可以轻松转换。

[旧答案:]

您必须使用 boost 1.39 或更高版本(通过 SVN)。 此演示文稿应该有所帮助:

简而言之,有一种全新的做事方式,这些就是命名空间使用:

  • boost::spirit:qi (对于解析器)
  • boost::spirit::karma (对于生成器库)

官方版本是 1.40,所以可能是这个文档更新的时间。

编辑: boost SVN 存储库中的文档< /a> 正在开发中,可能会以更忠实的方式反映新架构。

[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.

等风来 2024-07-28 22:24:44

当您包含经典标头时,解析器位于 boost::spirit::classic 命名空间中。 尝试:

使用命名空间 boost::spirit::classic;

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

using namespace boost::spirit::classic;

妖妓 2024-07-28 22:24:44

当库指示类/标头/方法/等时。 已弃用,这意味着库的维护者很可能会停止维护该功能,并可能在将来删除它。 我建议尽早切换到建议的标题,以免将来出现麻烦。

新标头处理该功能的方式可能略有不同,因此您可能需要进行一些代码更改。

(我对boost了解不多,这只是一般性评论)

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文