我刚学C++,今天编写了一个程序,可以compile,但是无法build,不知怎么回事儿,望各位达人指正。
程序如下:
#include <stdio.h>
#include <iostream.h>
#include <iomanip.h>
class Customer
{
public:
char Id[5];
char Firstname[12];
char Lastname[16];
char Address[30];
char Suburb[16];
char Postcode[4];
char BirthDate[10];
public:
Customer();
void ReadCustomer();
void ShowCustomer();
};
void Customer::ReadCustomer()
{
cout<<"Enter Id number: ";
cin>>Id;
cout<<"Enter firstname: ";
cin>>Firstname;
cout<<"Enter lastname: ";
cin>>Lastname;
cout<<"Enter address: ";
cin>>Address;
cout<<"Enter address: ";
gets(Address);
cout<<"Enter suburb: ";
cin>>Suburb;
cout<<"Enter postcode: ";
cin>>Postcode;
cout<<"Enter birth date:";
cin>>BirthDate;
}
void Customer::ShowCustomer()
{
cout<<"Id number: "<<Id<<endl;
cout<<"Name: "<<Firstname<<" "<<Lastname<<endl;
cout<<"Address: "<<Address<<endl;
cout<<"BirthDate: "<<BirthDate<<endl;
}
void main()
{
Customer C;
C.ReadCustomer();
C.ShowCustomer();
}
错误如下:
ex11bq1.obj : error LNK2001: unresolved external symbol "public: __thiscall Customer::Customer(void)" (??0Customer@@QAE@XZ)
Debug/ex11bq1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
ex11bq1.exe - 2 error(s), 0 warning(s)