title: How to use variables and functions declared in a header in C++
body: <p>First of all this might be messy, because I'm pretty new to programming in general.<br>
  Well I'm making a rpg game and I want all my weapons to be in a file called Weapons.cpp.<br>
  I made it so that I got all of my global variables such as "weaponDamage" and "weaponName" in a header file called common.h so that I can access and manipulate those variables from both my main and my .cpp file. But the problem is that it can't seem to find those variables and functions in my header. </p>
  
  <p>Here's some code:</p>
  
  <p><strong>common.h:</strong>  </p>
  
  <pre><code>#include &lt;string&gt;  
  #ifndef COMMON_H_INCLUDED  
  #define COMMON_H_INCLUDED  
  
  //global variables  
  extern int pureDamage = 0;  
  extern int pureHealth = 0;  
  extern int weaponDamage;  
  extern int armorDefense;  
  extern int totalDamage = pureDamage + weaponDamage;  
  extern int totalHealth = pureHealth + armorDefense;  
  extern int totalLuck;  
  extern string starsign;  
  extern string weaponName;  
  
  //all weapons  
  
  void weaponSwordIron();  
  void weaponSwordGold();  
  void weaponSwordSwordOfTheHeavens();  
  void weaponBowSimple();  
  void weaponBowLongBow();  
  void weaponBowThunder();  
  void weaponStaffStaffOfFlames();  
  void weaponStaffStaffOfLightning();  
  void weaponStaffStaffOfAssKicking();  
  
  #endif // COMMON_H_INCLUDED  
  </code></pre>
  
  <p><strong>Weapons.cpp:</strong>  </p>
  
  <pre><code>#include &lt;iostream&gt;  
  #include &lt;string&gt;  
  #include &lt;common.h&gt;  
  
  
  using namespace std;
  
  void weaponSwordIron()
  {
      int weaponDamage = 5;
      string weaponName = "Iron Sword";
  }
  void weaponSwordGold()
  {
      int weaponDamage = 8;
      string weaponName = "Gold Sword";
  }
  void weaponSwordSwordOfTheHeavens()
  {
      int weaponDamage = 15;
      string weaponName = "Sword Of The Heavens";
  }
  void weaponBowSimple()
  {
      int weaponDamage = 5;
      string weaponName = "Simple Bow";
  }
  void weaponBowLongBow()
  {
      int weaponDamage = 8;
      string weaponName = "Long Bow";
  }
  void weaponBowThunder()
  {
      int weaponDamage = 15;
      string weaponName = "Thunder Bow";
  }
  void weaponStaffStaffOfFlames()
  {
      int weaponDamage = 5;
      string weaponName = "Staff Of Flames";
  }
  void weaponStaffStaffOfLightning()
  {
      int weaponDamage = 8;
      string weaponName = "Staff Of Lightning";
  }
  void weaponStaffStaffOfAssKicking()
  {
      int weaponDamage = 15;
      string weaponName = "Staff Of Ass Kicking";
  } 
  </code></pre>
  
  <p>and a little piece of my main, the function called <code>GiveWeapon()</code>: </p>
  
  <pre><code>void GiveWeapon()
  {
  
      system("cls");
      if (starsign == "mage")
      {
          weaponSwordIron();
          cout &lt;&lt; weaponDamage;
          cout &lt;&lt; weaponName;
      }
      else if (starsign == "warrior")
      {
          weaponBowSimple();
      }
      else if (starsign == "archer")
      {
          weaponStaffStaffOfFlames();
      }
      else
      {
          ChooseStarsign();
      }
      AssignAttributes();
  }  
  </code></pre>
  
  <p>And yes I did remember to include common.h<br>
  Now the error my IDE <code>Code::Blocks</code> comes up with is : error: common.h: no such file or directory<br>
  I don't know why it comes up with that so please help.    </p>
  
  <p>Sorry for the long post and thanks in advance.</p>