2015-06-27 65 views
-3

以下行:
Libtorrent:宣佈廢棄的錯誤

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

顯示下面的錯誤:

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

我如何可以解決此問題?

+0

你使用什麼程序? – Ediac

+0

無法閱讀文檔。看起來好像你沒有看到它,說實話。 –

回答

1

您是否閱讀了torrent_info.hpp中的評論?

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

因此,應該轉換您寬字符的argv [1]爲UTF-8使用由libtorrent提供的功能,然後構造從您的torrent_info。

+0

謝謝我做了一個'(wchar *)'鑄造變量來解決錯誤。 :-) – sjsam

0

此消息通常只是一個警告,也許你有一個標誌將警告視爲錯誤。嘗試刪除/WX編譯器標誌,Treat Warnings as Errors選項,或者通過添加此標誌或選項:/wd 4996來禁用此特定警告。 More info on MSVC warning flags...

+0

將所有警告視爲錯誤被禁用,即我有'/ WX-' – sjsam