#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main(int argc, char* argv[])
{
struct sockaddr_in server_addr;
struct hostent* host;
....
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(nPort);
server_addr.sin_addr = *((struct in_ddr*)host->h_addr); /*It complains as below while building*/
....
}
client.cpp:在函数'int main(int,char **)'中: client.cpp:56:错误:'server_addr.sockaddr_in :: sin_addr = *(in_ddr *)中的'operator ='不匹配(* host-&gt; hostent :: h_addr_list)' /usr/include/netinet/in.h:138:注意:候选人是:in_addr&amp; in_addr :: operator =(const in_addr&amp;) * 错误代码1 clearmake:错误:“客户端”
的构建脚本失败我的实施发生了什么?
答案 0 :(得分:0)