LNK 2019简单构造函数

时间:2016-12-18 11:32:47

标签: c++ lnk2019

我是c ++中的新手。我几个小时都无法弄清楚我做错了什么。任何帮助都很重要。问题是在main中调用构造函数时:

错误LNK2019:函数中引用的未解析的外部符号“public:__thiscall imaging :: Image :: Image(void)”(?? 0Image @ imaging @@ QAE @ XZ)

   //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;
}

0 个答案:

没有答案