我正在学习 C++,并且有一个简单的 Date 类,我正在尝试为 Date 设置一个值。
这是源代码文件 -
日期.h
class Date{
private:
int month;
int day;
int year;
public:
Date();
void setDate(int m, int d, int y);
};
和日期.cpp
#include "Date.h"
Date::Date()
{
month = 1;
day = 1;
year = 80;
};
void Date :: setDate(int m1, int d1, int y1){
month = m1;
day = d1;
year = y1;
};
但是,当我编译代码时,我收到错误消息 -
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
有人可以帮忙吗?
谢谢