-----client.h---------------------------
ifndef CLIENT_H
#define CLIENT_H
#include
#include
using namespace std;
class client{
public:
static string ServerName;
static int ClientNum;
static void ChangeServerName();
static void printClientNum();
client();
};
#endif
-----client.cpp---------------------------
#include "client.h"
int client:: ClientNum = 0;
string ServerName = "hello";
void client:: ChangeServerName(){
cout<<"输入服务器名称: ";
cin>>ServerName;
}
void client::printClientNum(){
cout<<"客户机数量为: "<
client::client(){
ClientNum++;
}
-----main.cpp----------------------------
#include"client.h"
void main(){
client C1;
client::printClientNum();
client C2;
client::printClientNum();
}
------------------------------------------------------------------------------------------------------
出现了错误:client.obj : error LNK2001: 无法解析的外部符号 "public: static class std::basic_string
1 个无法解析的外部命令,求解!