发新话题
打印

AIX 下有 gethostbyname SunOS 下没有gethostbyname 函数 ???

AIX 下有 gethostbyname SunOS 下没有gethostbyname 函数 ???

各位:帮忙看一下这段程序

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <rpc/rpc.h>
#include <netdb.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>

main (){
struct hostent *hostp;
if ((hostp = gethostbyname("sunv880-2")) != NULL)
{
printf("gethostbyname successful\n");
}
else
{
printf("gethostbyname failure\n");
}
}

在 sunos 5.8 下用 cc -g test3c -o test3exe 编译是显示错误如下:

Undefined first referenced
symbol in file
gethostbyname test3.o

这段程序在 AIX 上执行没有问题!

是什么原因,请各位多多指教!

谢谢!


冷血      
冷血

TOP

发新话题