title: Already defined in main.obj
body: <p>This is the code for my problem and i get 4 errors:</p>
  
  <blockquote>
    <ol>
    <li>student.obj : error LNK2005: "struct Node * admitedFirstNode" (?admitedFirstNode@@3PAUNode@@A) already defined in main.obj</li>
    <li>student.obj : error LNK2005: "struct Node * allFirstNode" (?allFirstNode@@3PAUNode@@A) already defined in main.obj</li>
    <li>student.obj : error LNK2005: "struct Node * rejectedFirstNode" (?rejectedFirstNode@@3PAUNode@@A) already defined in main.obj</li>
    <li>pb4_OOP_lab1\Debug\pb4_OOP_lab1.exe : fatal error LNK1169: one or more multiply defined symbols found</li>
    </ol>
  </blockquote>
  
  <pre><code>#include "students.h"                          //main 
  int main()                                         
  {
  for(int i=0;i&lt;NR_STUDENTS;i++)
  {
      Student *s1=new Student;
      cout&lt;&lt;"Enter name: ";
      getline(cin,s1-&gt;name);
      cout&lt;&lt;"Enter garde: ";
      cin&gt;&gt;s1-&gt;grade;
      cin.ignore();
      addStudent(s1);
      delete s1;
  }
  
  }
  #include "students.h"                           //students.cpp
  
  void AddNodeToList(Node *firstNode, Student *studToAdd)
  {
  Node *nodeToAdd=new Node;
  nodeToAdd-&gt;student=studToAdd;
  nodeToAdd-&gt;next=NULL;
  
  if(firstNode==NULL)
  {
      firstNode=nodeToAdd;
  }
  else
  {
      Node *temp;
      temp=firstNode;
      while(temp-&gt;next != NULL)
      {
          temp=temp-&gt;next;
      }
      temp-&gt;next=nodeToAdd;
  }
  }
  void addStudent(Student *studentToAdd)
  {
  AddNodeToList(allFirstNode,studentToAdd);
  }
  
  void split()
  {
  Node *temp=allFirstNode;
  while(temp-&gt;next != NULL)
  {
      Student *currentStud=temp-&gt;student;
      if(currentStud-&gt;grade &lt; GR)
      {
          AddNodeToList(rejectedFirstNode,currentStud);
      }
      else    
      {
          AddNodeToList(admitedFirstNode,currentStud);
      }
  }
  }
  
  void print(Node *firstNode)
  {
  
  if(firstNode==NULL)
  {
      return;
  }
  else
  {
      Node *temp=firstNode;
      Student *current=temp-&gt;student;
      while(temp-&gt;next != NULL)
      {
          cout&lt;&lt;"----------------------------------------------"&lt;&lt;endl;
          cout&lt;&lt;"Student name: "&lt;&lt;current-&gt;name&lt;&lt;endl;
          cout&lt;&lt;"Student grade: "&lt;&lt;current-&gt;grade&lt;&lt;endl;
      }
  }
  }
  
  #include &lt;iostream&gt;                       //students.h
  #include &lt;string&gt;
  
  using namespace std;
  
  const int NR_STUDENTS=5;
  const double GR=5.0;
  
  struct Student
  {
  string name;
  double grade;
  };
  
  struct Node
  {
  Student *student;
  Node *next;
  };
  
  Node *allFirstNode;
  Node *admitedFirstNode;
  Node *rejectedFirstNode;
  
  void addStudent(Student *studentToAdd);
  void split();
  void sort();
  void print();
  </code></pre>