0

Im new in c++.I cant figure out what i am doing wrong for hours.Any help would be important.The problem is when calling the constructor in main:

error LNK2019: unresolved external symbol "public: __thiscall imaging::Image::Image(void)" (??0Image@imaging@@QAE@XZ) referenced in function

   //Image.h
     #ifndef _IMAGE
    #define _IMAGE
    namespace imaging
    {

class Image{
public:

    unsigned int width,                         
        height;                    


    const unsigned int getWidth() const { return width; }

    const unsigned int getHeight() const { return height; }

    Image();
};

 } //namespace imaging

#endif


  //Image.cpp
  #ifndef _IMAGE
   #define _IMAGE
    #include "Image.h"
     namespace imaging
      {

class Image{
public:

    unsigned int width,                         
        height;                    


    const unsigned int getWidth() const { return width; }

    const unsigned int getHeight() const { return height; }

    Image::Image():width(0),height(0){
   }
};

} //namespace imaging

#endif





#include "stdafx.h"
 #include "Image.h"
  using namespace imaging;

    int main()
     {
      Image * image = new Image();
     return 0;
}
C.Iza
  • 1
  • 1
  • 1
    Why are you declaring your `Image` class in *both* the header and the .cpp file? The declaration belongs in the header; the non-inline implementation in the .cpp file. – WhozCraig Dec 18 '16 at 11:35
  • Thanks a lot man.That saved my day. – C.Iza Dec 18 '16 at 11:41

0 Answers0