title: Function compiles correctly, but it doesn't compile as a member function of a class
body: <p>I am new to c++ and I dont know much yet. I have this strange problem. I have a function which is working correctly, but when I try to run it as a member function of a class without any change, it does not work
  it says:
  undefined reference to gsiread::get_rows(char *)</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  //vector&lt;string&gt; get_rows ( char filepath[] );  ... it works
  
  class gsiread  {
  
          public:
          vector&lt;string&gt; get_rows ( char filepath[] ); ... it doesnt work
  
          private:
          };
  
  vector&lt;string&gt; get_rows ( char filepath[] ) {
  
     vector&lt;string&gt; data;
     string str;
  
     ifstream file;
     file.open(filepath);
  
      if( file.is_open() ) {
          while( getline(file,str) ) {
  
          if ( str.empty() ) continue;
          data.push_back(str);
  
          }
      }
      return data;
  }
  
  // This part is "like" main i am using Qt creator and i have copied parts of code
     from separate files
  
  gsiread obj;
  
  vector&lt;string&gt; vypis;
  vypis = obj.get_rows("ninja.txt"); ....... //This doesnt work
  
  vypis = get_rows("ninja.txt");  .......... //This works if I put declaration of
                                             //function get_rows outside the class and
                                             //and use // on declaration inside the class
  
  for( int i = 0; i &lt; vypis.size(); i++ ) {
  
      QString n = QString::fromStdString(vypis[i]);
  
      QString t = "%1 \n";
  
      ui-&gt;plainTextEdit-&gt;insertPlainText(t.arg(n));
  
  
      // QString is like string but zou have to use it if wanna use widgets
      // of qt (I think )
  }
  </code></pre>