C++ 编译器错误2019未解析的外部符号

C++ 编译器错误2019未解析的外部符号,c++,compiler-errors,lnk2019,unresolved-external,C++,Compiler Errors,Lnk2019,Unresolved External,我试图编译一个程序,以确保所有的代码都正常工作。我收到一个未解决的外部错误,并显示以下消息: 1>------ Build started: Project: Week 2 Dating Service, Configuration: Debug Win32 ------ 1> Client.cpp 1>Client.obj : error LNK2019: unresolved external symbol "private: void __thiscall Client

我试图编译一个程序,以确保所有的代码都正常工作。我收到一个未解决的外部错误,并显示以下消息:

1>------ Build started: Project: Week 2 Dating Service, Configuration: Debug Win32 ------
1>  Client.cpp
1>Client.obj : error LNK2019: unresolved external symbol "private: void __thiscall Client::checkName(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?checkName@Client@@AAEXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __thiscall Client::Client(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0Client@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Client.obj : error LNK2019: unresolved external symbol "private: void __thiscall Client::checkSex(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?checkSex@Client@@AAEXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __thiscall Client::Client(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0Client@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
1>Client.obj : error LNK2019: unresolved external symbol "private: void __thiscall Client::checkPhone(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?checkPhone@Client@@AAEXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: __thiscall Client::Client(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0Client@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z)
1>C:\Users\owner\Documents\Visual Studio 2010\Projects\CISS 350\Week 2 Dating Service\Debug\Week 2 Dating Service.exe : fatal error LNK1120: 3 unresolved externals
1>----构建已启动:项目:第2周约会服务,配置:调试Win32------
1> Client.cpp
1> Client.obj:错误LNK2019:未解析的外部符号“private:void\u thiscall Client::checkName(类std::basic\u string&”)(?checkName@Client@@AAEXAAV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@函数“public:\u thiscall Client::Client(类std::basic\u string)”中引用了2@@std@@@Z)(??0客户@@QAE@V?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@@std@@@Z)
1> Client.obj:错误LNK2019:未解析的外部符号“private:void\u thiscall Client::checkSex(类std::basic\u string&”)(?checkSex@Client@@AAEXAAV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@函数“public:\u thiscall Client::Client(类std::basic\u string,类std::basic\u string)”中引用了2@@std@@@Z)(??0客户@@QAE@V?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@0@Z)
1> Client.obj:错误LNK2019:未解析的外部符号“private:void\u thiscall Client::checkPhone(类std::basic\u string&”)(?checkPhone@Client@@AAEXAAV?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@函数“public:\u thiscall Client::Client”中引用了2@@std@@@Z)(类别标准::基本\u字符串,类别标准::基本\u字符串,类别标准::基本\u字符串)“(??0客户端@@QAE@V?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@00@Z)
1> C:\Users\owner\Documents\Visual Studio 2010\Projects\CISS 350\Week 2 Dating Service\Debug\Week 2 Dating Service.exe:致命错误LNK1120:3个未解决的外部问题
这是我所有的代码

标题: //Client.h class.class的规范文件将保存成员数据,并提供访问数据所需的函数

#ifndef CLIENT_H
#define CLIENT_H
#include <iostream>
#include <vector>

using namespace std;

class Client
{
private:
//Member Variables
string name;    //Hold the clients name
string sex; //Single char to hold sex
string phone; //Holds 7 digit phone number
vector<string> interests;

//Private Member functions
void interest(vector<string>);
void checkName(string &);
void checkSex(string &);
void checkPhone(string &);

public:
//Public Variables
bool hasMatch;
string match;

//Constructors
Client();
Client(string);
Client(string, string);
Client(string, string, string);
Client(string, string, string, vector<string>);

//Mutators
void setName(string);
void setSex(string);
void setPhone(string);
void setInterests(vector<string>);
void setClient(string, string, string, vector<string>);


//Accessors
void getName(string &);
void getSex(string &);
void getPhone(string &);
void getInterests(vector<string> &);
void getClient(string &, string &, string &, vector<string> &);

};


#endif
\ifndef客户端
#定义客户端
#包括
#包括
使用名称空间std;
类客户端
{
私人:
//成员变量
字符串名称;//保留客户端名称
字符串sex;//保存sex的单个字符
字符串电话;//包含7位电话号码
媒介利益;
//私人成员职能
无效利息(矢量);
void checkName(字符串&);
无效校验性(字符串&);
void checkPhone(字符串&);
公众:
//公共变量
布尔·哈斯马特;
字符串匹配;
//建设者
客户机();
客户端(字符串);
客户端(字符串,字符串);
客户端(字符串,字符串,字符串);
客户端(字符串、字符串、字符串、向量);
//突变子
void setName(字符串);
void setSex(字符串);
无效设置电话(字符串);
无效利息(向量);
void setClient(字符串、字符串、字符串、向量);
//访问者
void getName(字符串&);
void getSex(字符串&);
void getPhone(字符串&);
无效利益(向量&);
void getClient(string&,string&,string&,vector&);
};
#恩迪夫
实施文件:

//Implementation file for the Client.h class. 

#include <iostream>
#include <string>
#include <vector>
#include "Client.h"

using namespace std;

//Private Member functions
void Client::interest(vector<string> inter)
{
int vecSize = inter.size();
for(int i = 0; i < vecSize; i++)
{
    interests[i] = inter[i];
}
}
void checkName(string &nm)
{
do
{
    cout << "Name is longer than 20 characters. Please enter a new name:";
    cin >> nm;
} 
while(nm.size() > 20);
}
void checkSex(string &sx)
{
int size = sx.size();

if(size > 1)
{
    sx = sx[0];
}

do
{
    if(sx != "M" || sx != "m" || sx != "F" || sx != "f")
    {
        cout << "Please enter sex(M or F):";
        cin >> sx;
    }
}
while(sx != "M" || sx != "m" || sx != "F" || sx != "f");
}
void checkPhone(string &ph)
{
int size = ph.size();
bool isGood= true;

if(size > 8)
    isGood = false;

for(int i = 0; i < size; i++)
{
    if(static_cast<int>(ph[i]) != 32 && ph[i] > '9'|| ph[i] < '0')
    {
        isGood = false;
    }
}

if(isGood == false)
{
    cout << "Phone number not valid.\n" << "Please enter a new number:";
    cin >>ph;
    checkPhone(ph);
}
}

//Contructors
Client::Client()
{
name = " ";
phone = " ";
sex = " ";
interests[0] = " ";
hasMatch = false;
match = " ";
}

Client::Client(string nm)
{
checkName(nm);
name = nm;
phone = " ";
sex = " ";
interests[0] = " ";
hasMatch = false;
match = " ";
}

Client::Client(string nm, string sx)
{
checkName(nm);
name = nm;
phone = " ";
checkSex(sx);
sex = sx;
interests[0] = " ";
hasMatch = false;
match = " ";
}

Client::Client(string nm, string sx, string ph)
{
checkName(nm);
name = nm;
checkPhone(ph);
phone = ph;
checkSex(sx);
sex = sx;
interests[0] = " ";
hasMatch = false;
match = " ";
}

Client::Client(string nm, string sx, string ph, vector<string> inter)
{
checkName(nm);
name = nm;
checkPhone(ph);
phone = ph;
checkSex(sx);
sex = sx;
interest(inter);
hasMatch = false;
match = " ";
}

//Mutators
void Client::setName(string nm)
{
checkName(nm);
name = nm;
}
void Client::setSex(string sx)
{
checkSex(sx);
sex = sx;
}
void Client::setPhone(string ph)
{
checkPhone(ph);
phone = ph;
}
void Client::setInterests(vector<string> inter)
{
interest(inter);
}
void Client::setClient(string nm, string sx, string ph, vector<string> inter)
{
checkName(nm);
name = nm;
checkPhone(ph);
phone = ph;
checkSex(sx);
sex = sx;
interest(inter);
}

//Accessors
void Client::getName(string &nm)
{
nm = name;
}
void Client::getSex(string &sx)
{
sx = sex;
}
void Client::getPhone(string &ph)
{
ph = phone;
}
void Client::getInterests(vector<string> &inter)
{
inter = interests;
}
void Client::getClient(string &nm, string &sx, string &ph, vector<string> &inter)
{
nm = name;
sx = sex;
ph = phone;
inter = interests;
}
//Client.h类的实现文件。
#包括
#包括
#包括
#包括“Client.h”
使用名称空间std;
//私人成员职能
无效客户端::利息(向量间)
{
int vecSize=inter.size();
对于(int i=0;inm;
} 
而(纳米尺寸()>20);
}
无效校验性(字符串和sx)
{
int size=sx.size();
如果(大小>1)
{
sx=sx[0];
}
做
{
如果(sx!=“M”| sx!=“M”| sx!=“F”| sx!=“F”)
{
cout>sx;
}
}
而(sx!=“M”| sx!=“M”| sx!=“F”| sx!=“F”);
}
void checkPhone(字符串和ph)
{
int size=ph.size();
bool isGood=true;
如果(尺寸>8)
isGood=错误;
对于(int i=0;i'9'| ph[i]<'0')
{
isGood=错误;
}
}
如果(isGood==false)
{
cout-ph;
检查电话(ph);
}
}
//承包商
客户机::客户机()
{
name=“”;
电话=”;
性别=”;
利息[0]=“”;
hasMatch=false;
match=“”;
}
客户端::客户端(字符串nm)
{
支票名称(nm);
名称=纳米;
电话=”;
性别=”;
利息[0]=“”;
hasMatch=false;
match=“”;
}
客户端::客户端(字符串nm、字符串sx)
{
支票名称(nm);
名称=纳米;
电话=”;
检查性别(sx);
性别=sx;
利息[0]=“”;
hasMatch=false;
match=“”;
}
客户端::客户端(字符串nm、字符串sx、字符串ph)
{
支票名称(nm);
名称=纳米;
检查电话(ph);
电话=ph;
检查性别(sx);
性别=sx;
利息[0]=“”;
hasMatch=false;
match=“”;
}
客户机::客户机(字符串nm、字符串sx、字符串ph、向量inter)
{
支票名称(nm);
名称=纳米;
检查电话(ph);
电话=ph;
检查性别(sx);
性别=sx;
利息(国际);
hasMatch=false;
match=“”;
}
//突变子
void Client::setName(字符串nm)
{
支票名称(nm);
名称=纳米;
}
无效客户端::setSex(字符串sx)
{
检查性别(sx);
性别=sx;
}
void Client::setPhone(字符串ph)
{
检查电话(ph);
电话=ph;
}
void Client::setinterest(向量间)
{
利息(国际);
}
void Client::setClient(字符串nm、字符串sx、字符串ph、向量inter)
{
支票名称(nm);
名称=纳米;
检查电话(ph);
电话=ph;
检查性别(sx);
性别=sx;
利息(国际);
}
//访问者
无效客户端::getName(字符串和nm)
{
nm=名称;
}
void客户端::getSex(字符串和sx)
{
sx=性别;
}
无效客户端::getPhone(字符串和ph)
{
ph=电话;
}
无效客户端::GetInterest(向量和内部)
{
内部=利益;
}
void Client::getClient(string&nm、string&sx、string&ph、vector&inter)
{
nm=名称;
sx=性别;
ph=电话;
内部=利益;
}
主文件:

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <list>
#include "Client.h"

using namespace std;

//Global Variables


//Function Prototypes
char MainMenu();
void AddMenu();
void PrintMenu();
bool InitLoad();
void closeProgram();


int main()
{
list<Client> males;
list<Client> females;
Client mClient;
Client fClient;

char choice;

do
{
choice = MainMenu();


switch(choice)      //Switch to to call either user selection
    {
    case ('1'):
        {
            AddMenu();
            break;
        }
    case ('2'):
        {
            PrintMenu();
            break;
        }
    case ('3'):
        {
            closeProgram(); 
        }
    }
}
while(choice <= '3' || choice >= '1' || isalpha(choice));       //input      validation to ensure the user selects an acceptable value
}

char MainMenu()
{
char choice;    //For main menu choice
cout << endl;
do
{
cout << "Main Menu\n" << "1. Client Menu\n" << "2. Print Menu\n" 
        << "3. Exit\n";
    cout << "Selection: ";
    cin >> choice;
    cout << endl;
}   
while(choice < '1' || choice > '3' || isalpha(choice));     //input validation to ensure the user selects an acceptable value

return choice;
}
void AddMenu()
{
char choice;    //For main menu choice
cout << endl;
do
{
cout << "Client Menu\n" << "1. Add Client\n" << "2. UnMatch Client\n" 
        << "3. Match Client\n" << "4. Return\n";
    cout << "Selection: ";
    cin >> choice;
    cout << endl;
}   
while(choice < '1' || choice > '4' || isalpha(choice));     //input validation to ensure the user selects an acceptable value
 }
void PrintMenu()
{
char choice;    //For main menu choice
cout << endl;
do
{
cout << "Print Menu\n" << "1. Print Matched Clients\n" << "2. Print Free Clients\n" 
        << "3. Print All Clients\n" << "4. Return\n";
    cout << "Selection: ";
    cin >> choice;
    cout << endl;
}   
while(choice < '1' || choice > '4' || isalpha(choice));     //input validation to ensure the user selects an acceptable value
}
bool InitLoad()
{
return true;
}
void closeProgram()
{

}
#包括
#包括
#包括
#包括
#包括
#包括“Client.h”
使用名称空间std;
//全局变量
//功能原型
char main menu();
void AddMenu();
作废打印菜单();
bool InitLoad();
void closeProgram();
int main()
{
列出男性;
列出女性;
客户mClient;
客户;
字符选择;
做
{
choice=main菜单();
switch(choice)//切换到调用任一用户选择
{
案例(“1”):
{
添加菜单();
打破
}
案例(“2”):
{
打印菜单();
打破
}
案例(“3”):
{
closeProgram();
}
}
}
while(choice='1'| | isalpha(cho
void checkName(string &nm)
void Client::checkName(string &nm)