自定义了一个结构体,调用出现错误:没有合适的构造函数??
struct stru_pack_data //自定义包结构
{
string Myip;
string Mymac;
string MyGw;
string Sip;
string Dip;
string Smac;
string Dmac;
string type_data;
int Send_Port;
int Recv_Port;
int ipMess_type;
int Ethernet_type;
stru_pack_data(string _Myip, string _Mymac, string _MyGw)// 构造函数
{
Myip = _Myip;
Mymac = _Mymac;
MyGw = _MyGw;
Sip = "255.255.255.255";
Dip = _Myip;
Smac = "FFFFFFFFFFFF";
Dmac = _Mymac;
Send_Port = 67;
Recv_Port = 5361;
ipMess_type = 17;
Ethernet_type = 8;
type_data = "Release";
}
}srpcdt,SRPCDT;
int main()
{
string data;
srpcdt = stru_pack_data("192.168.31.188", "F0DEF1DFF5E9", "192.168.31.1"); //错误:stru_pack_data没有合适的构造函数
cout << srpcdt.Myip << endl;
return 0;
}