hi guys,
i am newbie of socket programming working on solaries sysetm.
Code:
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include<errno.h>
#include<assert.h>
int main(int argc,char *argv[])
{
struct hostent *h;
assert(argc!=2);
h=gethostbyname(argv[1]);
printf("host name %s\n",h->h_name);
return 0;
}
while i am compiling this programm i am getting error's
Code:
$cc gethostname.c
Undefined first referenced
symbol in file
gethostbyname gethostname.o
ld: fatal: Symbol referencing errors. No output written to a.out
anybody please help me where is error
~