title: C++ Default Arguments - Declaration
body: <p>I created a function in my class. I put all my declarations in my header file and all my definitions in my .cpp .</p>
  <p>In my <em>header</em> :</p>
  <pre><code>class FileReader{
   
  public:
  FileReader(const char*);                        //Constructor
  std::string trim(std::string string_to_trim, const char trim_char = '=');
  
  };
  </code></pre>
  <p>In my <em>.cpp</em> :</p>
  <pre><code>std::string FileReader::trim(std::string string_to_trim, const char trim_char = '='){
  
  std::string _return;
  for(unsigned int i = 0;i &lt; string_to_trim.length();i++){
      if(string_to_trim[i] == trim_char)
          continue;
      else
          _return += string_to_trim[i];
  }
  
         return _return;
  }
  </code></pre>
  <p>Whenever I try to compile and run it, I get two errors.</p>
  <blockquote>
  <p>error: default argument given for parameter 2 of 'std::string FileReader::trim(std::string, char)' [-fpermissive]</p>
  <p>error: after previous specification in 'std::string FileReader::trim(std::string, char)' [-fpermissive]</p>
  </blockquote>
  <p><strong>What am I doing wrong? I just want my function to have this default argument.</strong></p>