title: Unresolved External symbol "class"
body: <p><strong>Error</strong>
  LNK2001 unresolved external symbol "class Object objects"</p>
  
  <p>When the class is declared as an extern, it will create this linker error for every piece of code connected to it. But when I create a private version of the class in other files, they work fine.</p>
  
  <p>Changing the name of the class variable has no effect, so it does not conflict with the mapping system causing the error.</p>
  
  <p>I am unable to see and amend the error. It was working previously to which I undid the files in the hopes of it functioning again, but it did not.</p>
  
  <p><strong>Object.cpp</strong></p>
  
  <pre><code>#include "object.h"
  
  #include "Ball.h"
  
  // Constructor
  Object::Object() {
  
      std::map&lt;int, std::map&lt;int, IMAGEINFO&gt;&gt; object;
  
  };
  
  Object::~Object() {
  
      object.clear();
  
  };    
  
  void Object::Update() {
  
      // Gets all the base object ID's
      for (unsigned int i = 0; i &lt; object.size(); i++) {
  
      // Gets all the object's inside that ID.
          for (unsigned int j = 0; j &lt; object[i].size(); j++) {
  
              // Gets the object.
              IMAGEINFO obj = object[i][j];
  
              // Calls for the processes of the object
              obj.Update();
          }
      }
  }
  
  void Object::Render(HDC hdc, RECT* prc, BITMAP bm) {
  
      // Gets all the base object ID's
      for (unsigned int i = 0; i &lt; object.size(); i++) {
  
          // Gets all the object's ID's. 
          for (unsigned int j = 0; j &lt; object[i].size(); j++) {
  
              // Gets the object.     
              IMAGEINFO obj = object[i][j];
  
              // Calls for the rendering of the object        
              obj.Render(hdc, prc, bm);
  
          }
      }
  }
  
  int Object::addObject(IMAGEINFO obj) {
  
      bool index = false;
      int indexVal;
      short run = 0;
  
      while (!index) {
  
          if (typeid(obj).name() == typeid(object[run]).name()) {
  
              object[run][object[run].size()] = obj;
              indexVal = object[run].size();
              index = true;
  
          }
          else if (run == object.size()) {
  
              object[run][0] = obj;
              indexVal = 0;
              index = true;
  
          }
  
          run++;
  
      }
  
      return indexVal;
  
  }
  </code></pre>
  
  <p><strong>object.h</strong></p>
  
  <pre><code>#ifndef OBJECT_H
  #define OBJECT_H
  #endif
  
  #include &lt;windows.h&gt;
  #include &lt;iostream&gt;
  #include &lt;map&gt;
  
  #include "renderer.h"
  #include "resource.h"
  
  class Object {
  public:
  
      // Constructors/Deconstructors
      Object();
      ~Object();
  
      // Processes
      int addObject(IMAGEINFO value);
      void Update();
      void Render(HDC hdc, RECT* prc, BITMAP bm);
  
  private:
  
      std::map&lt;int, std::map&lt;int, IMAGEINFO&gt;&gt; object;
  
  };
  
  extern Object objects;
  </code></pre>
  
  <p><strong>Ball.cpp</strong></p>
  
  <pre><code>#include "Ball.h";
  
  int indexPos;
  
  HBITMAP hbm_Ball_Image = NULL;
  HBITMAP hbm_Ball_Mask = NULL;
  
  IMAGEINFO ballInfo;
  
  void Ball(BITMAP bm, int assx, int assy) {
  
      indexPos = objects.addObject(ballInfo);
  
      hbm_Ball_Image = createImage((HBITMAP) BITMAP_BALL);
      hbm_Ball_Mask = createMask((HBITMAP)BITMAP_BALL, RGB(255, 255, 255), bm);
  
      GetObject(hbm_Ball_Image, sizeof(bm), &amp;bm);
  
      ballInfo.height = bm.bmHeight;
      ballInfo.width = bm.bmWidth;
  
      ballInfo.x = assx;
      ballInfo.y = assy;
  
      ballInfo.speedX = 1;
      ballInfo.speedY = 0;
  
  }
  </code></pre>
  
  <p><strong>ball.h</strong></p>
  
  <pre><code>#ifndef BALL_H
  #define BALL_H
  #endif
  
  #include &lt;windows.h&gt;
  #include &lt;iostream&gt;
  #include &lt;map&gt;
  
  #include "renderer.h"
  #include "resource.h"
  #include "object.h"
  
  void Ball(BITMAP bm, int assx, int assy);
  void render(HDC hdc, RECT* prc, BITMAP bm);
  </code></pre>