title: Paho MQTT C++ connection user and password
body: <p>I am implementing a client to send data over MQTT and I am using Paho MQTT c++ libs.
  Now I need to add support to user and password authentication and when I try to set them like this:</p>
  
  <pre><code>std::string user = "user";
  std::string password = "password";
  mqtt::connect_options connOpts;
  connOpts.set_user_name(user);
  connOpts.set_password(password);
  </code></pre>
  
  <p>and I get </p>
  
  <blockquote>
    <p>undefined reference to mqtt::connect_options::set_user_name(std:string
    const&amp;)</p>
  </blockquote>
  
  <p>but in the header file connection_options.h</p>
  
  <pre><code>/**
   * Sets the user name to use for the connection.
   * @param userName 
   */
  void set_user_name(const std::string&amp; userName);
  </code></pre>
  
  <p>same thing happens with set_password(password);</p>
  
  <p>Another issue I have is that I haven't been able to keep my connection alive because I can not have the mqtt::async_client object global in the class, I can only create it inside the publish function.</p>
  
  <p>Thanks in advance.</p>