title: putenv warning with C++
body: <p>I am trying to use <code>putenv</code> <code>stdlib</code> function in a program that I am compiling with <code>g++</code> including the flags and warnings <code>-std=c++11</code> and <code>-Wall -Wextra</code>.</p>
  
  <p>The program can be as easy as the following:</p>
  
  <pre><code>#include&lt;stdlib.h&gt;
  #include&lt;iostream&gt;
  int main(int argc, char *argv[])
  {
      putenv("LD_LIBRARY_PATH=../Desktop/lib");
      std::cout&lt;&lt;"hello\n";
      return 0;
  
  }
  </code></pre>
  
  <p>but I am getting this error <code>warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]</code>.</p>
  
  <p>As far as I understood in C++ I should declare: <code>char const *str =</code> but then <code>putenv</code> is complaining.</p>
  
  <p>I know I could cast but is there a proper way to use <code>putenv</code> function in C++ or being it a C function it should be completely avoided?</p>