title: Map of strings and int
body: <p>I want to make a DVD rental application in C++. I've made the basics of the customer class, and another class that holds the ids of the customers called CustomerDB. Each customer has a unique id.<br>
  I want to test CustomerDB before going further in the program, but I get an error when compiling the program.</p>
  
  <p>Here is the code I've written:</p>
  
  <p>Header file:</p>
  
  <pre><code>// DVD_App.h - Header File
  
  #include &lt;string&gt;
  #include &lt;map&gt;
  
  using namespace std;
  
  enum Status {ACTIVE, INACTIVE};
  
  class Customer {
      private:
          string id;
          string name;
          string address;
          Status status;
  
      public:
          Customer (const string&amp;, const string&amp;, const Status);
          string &amp;getId () { return id; }
  };
  
  class CustomerDB {
      private:
          static map&lt;string, int&gt; idList;
  
      public:
          static void addNewToIdList (const string &amp;threeLetterOfName) {
              if (!doesThreeLettersOfNameExist(threeLetterOfName))
                  idList.insert(pair&lt;string, int&gt;(threeLetterOfName, 0));
          }
  
          static bool doesThreeLettersOfNameExist (const string &amp;threeLetterOfName) {
              map&lt;string, int&gt;::iterator i = idList.find(threeLetterOfName);
              if ((i-&gt;first).compare(threeLetterOfName) != 0)
                  return false;
              return true;
          }
  
          static int nextNumber (const string &amp;threeLetterOfName) {
              map&lt;string, int&gt;::iterator i = idList.find(threeLetterOfName);
              ++(i-&gt;second);
              return i-&gt;second;
          }
  };
  </code></pre>
  
  <p>and the source code file:</p>
  
  <pre><code>// DVD_App.cpp - C++ Source Code
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "DVD_App.h"
  
  using namespace std;
  
  Customer::Customer (const string &amp;cName, const string &amp;cAddress, const Status cStatus) : name(cName), address(cAddress), status(cStatus) {
      string threeLetters = name.substr(0, 3);
      if (CustomerDB::doesThreeLettersOfNameExist(threeLetters))
          threeLetters += "" + CustomerDB::nextNumber(threeLetters);
      else {
          CustomerDB::addNewToIdList(threeLetters);
          threeLetters += "0";
      }
  }
  
  int main () {
      Customer k ("khaled", "beirut", ACTIVE);
      cout &lt;&lt; k.getId() &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>the error im getting is:</p>
  
  <pre><code>C:\Users\KiKo-SaMa\Desktop\C++&gt;g++ DVD_App.cpp
  C:\Users\KIKO-S~1\AppData\Local\Temp\ccSsS5HX.o:DVD_App.cpp:(.text$_ZN10Customer
  DB14addNewToIdListERKSs[CustomerDB::addNewToIdList(std::basic_string&lt;char, std::
  char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)]+0x59): undefined reference to
   `CustomerDB::idList'
  C:\Users\KIKO-S~1\AppData\Local\Temp\ccSsS5HX.o:DVD_App.cpp:(.text$_ZN10Customer
  DB27doesThreeLettersOfNameExistERKSs[CustomerDB::doesThreeLettersOfNameExist(std
  ::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)]+0x1
  0): undefined reference to `CustomerDB::idList'
  C:\Users\KIKO-S~1\AppData\Local\Temp\ccSsS5HX.o:DVD_App.cpp:(.text$_ZN10Customer
  DB10nextNumberERKSs[CustomerDB::nextNumber(std::basic_string&lt;char, std::char_tra
  its&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)]+0x10): undefined reference to `Custom
  erDB::idList'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>What is wrong with my program?</p>