title: Xcode linker error: linker command failed with exit code 1 (use -v to see invocation)
body: <p>Using C++ and Xcode I always run into this problem where linker command fails. I don't know what this means. I'm creating an elementary program that consists of 3 files. A main.cpp, and a class file that has a header. The main file is empty. This what the other two look like:</p>
  
  <p><strong>student.hpp :</strong></p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;cmath&gt;
  #include &lt;sstream&gt;
  
  std::string line;
  class Student{
  public:
      std::string fullName;
      int projectGrade;
      int quizGrade;
      int midtermGrade;
      int finalGrade;
      int finish;
      int start = 14;
  
      std::string getStudentName();
      int getProjectGrade();
      int getQuizGrade();
      int getMidtermGrade();
      int getFinalGrade();
      double getOverallGrade();
      bool login(std::string username, std::string password);
      bool login(std::string username);
  };
  </code></pre>
  
  <p><strong>student.cpp</strong>:</p>
  
  <pre><code>#include "student.hpp"
  
  std::string Student::getStudentName(){
      finish = line.find("\t", start);
      fullName = line.substr(start, finish);
      return fullName;
  }
  int Student::getProjectGrade(){
      start = line.find("\t", start) + finish;
      finish = start + 2;
      std::stringstream stream(line.substr(start, 2));
      stream &gt;&gt; projectGrade;
      return projectGrade;
  }
  int Student::getQuizGrade(){
      start+=3;
      std::stringstream stream(line.substr(start, 2));
      stream &gt;&gt; quizGrade;
      return quizGrade;
  }
  int Student::getMidtermGrade(){
      start+=3;
      std::stringstream stream(line.substr(start, 2));
      stream &gt;&gt; midtermGrade;
      return midtermGrade;
  }
  int Student::getFinalGrade(){
      start+=3;
      std::stringstream stream(line.substr(start, 2));
      stream &gt;&gt; finalGrade;
      return finalGrade;
  }
  double Student::getOverallGrade(){
      return round((projectGrade + quizGrade + midtermGrade + finalGrade)/40)*10;
  }
  bool Student::login(std::string username, std::string password){
      std::ifstream studentFile;
      studentFile.open("/Users/griffin/desktop/Data Structures/Data Structures1/Data Structures1/Students.txt");
      if(studentFile.is_open()){
          while(getline (studentFile,line))
          {
              if ((username.length() == 7 &amp;&amp; username.substr(0,4).compare("u000") == 0 &amp;&amp; line.find(username) != std::string::npos) &amp;&amp; (password.length() == 6 &amp;&amp; password.substr(0,2).compare("pw") == 0 &amp;&amp; line.find(password) != std::string::npos))
                  return true;
          }
      }
      return false;
  }
  bool Student::login(std::string username){
  
      std::ifstream studentFile;
      studentFile.open("/Users/griffin/desktop/Data Structures/Data Structures1/Data Structures1/Students.txt");
      if(studentFile.is_open()){
          while(getline (studentFile,line))
          {
              if (username.length() == 7 &amp;&amp; username.substr(0,4).compare("u000") == 0 &amp;&amp; line.find(username) != std::string::npos)
                  return true;
          }
      }
      return false;
  }
  </code></pre>
  
  <p>The main file includes student.hpp. Is this a problem on Xcode's end or do I have an error in my code?</p>
  
  <p><strong>Main.cpp</strong></p>
  
  <pre><code>#include "student.hpp"    
  int main(int argc, const char * argv[]) {
      return 0;
  }
  </code></pre>