Libtorrent set_settings 错误
Libtorrent set_settings error
我正在尝试设置会话设置,但我收到了一个我不太明白的错误,我能够使会话设置正常,根据 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 );
我正在尝试设置会话设置,但我收到了一个我不太明白的错误,我能够使会话设置正常,根据 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 );