C++ 在界面设计中使用函数显示日期

C++ 在界面设计中使用函数显示日期,c++,C++,有谁能帮我找出为什么会出现这些链接错误: Error 1 error LNK2019: unresolved external symbol "private: __thiscall Month::Month(int)" (??0Month@@AAE@H@Z) referenced in function "public: static class Month __cdecl Month::Jan(void)" (?Jan@Month@@SA?AV1@XZ) c:\Users\vige

有谁能帮我找出为什么会出现这些链接错误:

Error   1   error LNK2019: unresolved external symbol "private: __thiscall Month::Month(int)" (??0Month@@AAE@H@Z) referenced in function "public: static class Month __cdecl Month::Jan(void)" (?Jan@Month@@SA?AV1@XZ)  c:\Users\vigen\documents\visual studio 2012\Projects\Item18TestingInterface\Item18TestingInterface\Source.obj   Item18TestingInterface

Error   2   error LNK1120: 1 unresolved externals   c:\users\vigen\documents\visual studio 2012\Projects\Item18TestingInterface\Debug\Item18TestingInterface.exe    1   1   Item18TestingInterface
当我运行以下代码时

#include <iostream>
using namespace std;

struct Day {
    explicit Day(int d): val(d) {}
    int val;
};

struct Year {
    explicit Year(int y): val(y){};
    int val;
};


class Month {
    public:
        static Month Jan(){return Month(1);}
        static Month Feb(){return Month(2);}
        static Month Mar(){return Month(3);}
        static Month Apr(){return Month(4);}

        static Month May(){return Month(5);}
        static Month Jun(){return Month(6);}
        static Month Jul(){return Month(7);}
        static Month Aug(){return Month(8);}

        static Month Sep(){return Month(9);}
        static Month Oct(){return Month(10);}
        static Month Nov(){return Month(11);}
        static Month Dec(){return Month(12);}

    private:
        explicit Month(int m);
};

class Date {
    public:
        Date(Month& m, const Day& d, const Year& y){};
};

int main () {
    Date date(Month::Jan(), Day(30), Year(1995)); 
}
#包括
使用名称空间std;
结构日{
显式日(int d):val(d){}
int-val;
};
结构年{
显式年份(int y):val(y){};
int-val;
};
班级月份{
公众:
静态月份Jan(){返回月份(1);}
静态月份Feb(){返回月份(2);}
静态月份Mar(){返回月份(3);}
静态月份Apr(){返回月份(4);}
静态月份May(){返回月份(5);}
静态月份Jun(){返回月份(6);}
静态月份Jul(){返回月份(7);}
静态月份Aug(){返回月份(8);}
静态月份Sep(){返回月份(9);}
静态月份Oct(){返回月份(10);}
静态月份Nov(){返回月份(11);}
静态月份Dec(){返回月份(12);}
私人:
明确月份(整数m);
};
上课日期{
公众:
日期(月&m、施工日&d、施工年&y){};
};
int main(){
日期日期(月:一月(),日(30),年(1995));
}

明确月份(整数m)没有定义。将其更改为
explicit Month(int m){}
应该可以工作。

谢谢Dave。是的,我忘了在构造函数定义中添加{}。