【问题标题】:Libtorrent : declared deprecated errorLibtorrent:声明已弃用的错误
【发布时间】:2015-06-27 18:48:40
【问题描述】:

以下行:

p.ti = new torrent_info(argv[1], ec);

显示以下错误:

error C4996: 'libtorrent::torrent_info::torrent_info': was declared deprecated

我该如何解决这个问题?

【问题讨论】:

  • 你用的是什么程序?
  • 简单的阅读文档失败。老实说,您似乎甚至都没有查过它。

标签: c++ libtorrent


【解决方案1】:

你读过torrent_info.hpp中的cmets吗?

    // all wstring APIs are deprecated since 0.16.11
    // instead, use the wchar -> utf8 conversion functions
    // and pass in utf8 strings

因此,您应该使用 libtorrent 提供的函数将您的宽字符 argv[1] 转换为 UTF-8,然后从中构造您的 torrent_info。

【讨论】:

  • 谢谢我对解决错误的变量进行了(wchar*) 转换。 :-)
【解决方案2】:

这个消息通常只是一个警告,也许你有一个标志来将警告视为错误。尝试删除 /WX 编译器标志、Treat Warnings as Errors 选项,或通过添加此标志或选项禁用此特定警告:/wd 4996More info on MSVC warning flags...

【讨论】:

  • 将所有警告视为错误被禁用,即我有/WX-
猜你喜欢
  • 2020-04-10
  • 1970-01-01
  • 1970-01-01
  • 2022-10-14
  • 1970-01-01
  • 1970-01-01
  • 2023-02-16
  • 1970-01-01
  • 2012-07-03
相关资源
最近更新 更多