一个简单的代码问题,请大虾进来帮帮忙!急!
初次在linux下面写一个socket程序,但是在取ip的时候编译就报错!不知道是为什么,请各位大虾帮忙! 
                         /*   ......前面是一些定义和判断,因此从取ip的地方开始         */                                       
                         //   get   host   ip   from   server   name 
                         ip   =   inet_addr(serverName); 
                         if   (-1   ==   ip) 
                         { 
                                                 struct   hostent*   hostData   =   gethostbyname(serverName);   
                                                 if   (!hostData) 
                                                 { 
                                                                         printf( "DL:   Failed   to   get   IP   of   %s\n ",   serverName); 
                                                                         return   -1; 
                                                 } 
                                                 memcpy((char*)&ip,   hostData-> h_addr_list[0],   sizeof(ip)); 
                               } 
                               ...........   
 编译的时候指示struct   hostent*   hostData   =   gethostbyname(serverName)行的警告为:warning:   initialization   makes   pointer   from   integer   without   a   cast; 
 指示memcpy((char*)&ip,   hostData-> h_addr_list[0],   sizeof(ip))行的错误为:error:   dereferencing   pointer   to   incomplete   type, 
 小的冥思苦想也没有得出答案,请各位大虾帮忙了!   
------解决方案--------------------#include  <netdb.h>    
 你缺少这个文件.加上就ok