gpt4 book ai didi

c++ - Libtorrent set_settings 错误

转载 作者:行者123 更新时间:2023-11-28 06:20:12 26 4
gpt4 key购买 nike

我正在尝试设置 session 设置,但出现了一个我不太明白的错误,我能够正常设置 session ,根据 Libtorrent 文档,我只是将 session_settings 结构传递给 set_settings 一次我更改了任何值。

using namespace libtorrent;
session* Session;
session_status* Session_Status;
session_settings* Session_Settings;

bool Start_Client_Sess()
{
Session = new session;
Session_Status = new session_status;
Session_Settings = new session_settings;
Session->settings( );

std::cout << "upload_rate_limit " << Session_Settings->upload_rate_limit << " \n";
std::cout << "dht_announce_interval " << Session_Settings->dht_announce_interval << " \n";

Session_Settings->upload_rate_limit = 200;
Session_Settings->dht_announce_interval = 1800;

Session->set_settings( Session_Settings ); // error

}

错误:

1>Source\Client_F.cpp(66): error C2664: 'void libtorrent::session::set_settings(const libtorrent::session_settings &)' : cannot convert argument 1 from 'libtorrent::session_settings *' to 'const libtorrent::session_settings &'
1> Reason: cannot convert from 'libtorrent::session_settings *' to 'const libtorrent::session_settings'
1> No constructor could take the source type, or constructor overload resolution was ambiguous

最佳答案

如错误消息所述,您不必将指针传递给该函数。

Session->set_settings( *Session_Settings );

关于c++ - Libtorrent set_settings 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29436389/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com