Shrek
Shrek

Reputation: 347

Libtorrent set_settings error

I'm trying to set the session settings but I'm getting an error I don't quite understand, I am able to get the session settings OK and according to the Libtorrent docs I simply pass the session_settings structure to set_settings once I have changed any values.

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

}

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

Upvotes: 0

Views: 104

Answers (1)

ForceBru
ForceBru

Reputation: 44888

As the error message says, you don't have to pass a pointer to this function.

Session->set_settings( *Session_Settings );

Upvotes: 1

Related Questions