C语言程序LINK错误
我所编的C语言程序编译的时候都是OK的 可是到了build的时候就出现错误了2.obj : error LNK2005: "public: __thiscall Customer::Customer(void)" (??0Customer@@QAE@XZ) already defined in 1.obj
2.obj : error LNK2005: "public: virtual __thiscall Customer::~Customer(void)" (??1Customer@@UAE@XZ) already defined in 1.obj
2.obj : error LNK2005: "int i" (?i@@3HA) already defined in 1.obj
2.obj : error LNK2005: "struct Room * room" (?room@@3PAURoom@@A) already defined in 1.obj
2.obj : error LNK2005: "class Customer * * customer" (?customer@@3PAPAVCustomer@@A) already defined in 1.obj
应该是头文件定义的问题 求大神帮忙解决 谢谢了
头文件如下:
#include<iostream.h>
#include<string.h>
void initial_room();
void welcome();
void enter();
void book_room();
void check_in();
void check_out();
void inquire();
int i=0;
struct Room
{
int number;
int dank;
int price;
int state;
};
class Customer
{
public:
Customer();
void set_name(char *n) {strcpy(name,n);}
void set_ID(char *p) {strcpy(ID,p);}
void set_room_number(int n) {room_number=n;}
void set_day(int d) {day=d;}
void set_prepaid(int p) {prepaid=p;}
char *get_name() {return name;}
char *get_ID() {return ID;}
int get_room_number() {return room_number;}
int get_day() {return day;}
int get_prepaid() {return prepaid;}
virtual ~Customer();
private:
char name[10],ID[19];
int room_number;
int prepaid;
int change;
int day;
};
Customer::Customer()
{
cout<<"请输入顾客的姓名\n";
cin>>name;
cout<<"请输入顾客的身份证号\n";
cin>>ID;
prepaid=change=day=0;
}
Customer::~Customer()
{
cout<<"该顾客退房成功!"<<endl;
}
Room room[80];
Customer *customer[80];