Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

gethostbyname

Posted on 1998-04-07
5
Medium Priority
?
734 Views
Last Modified: 2013-12-26
UNIXer,

If I need to use gethostbyname in my program which is compile by gcc in SunSpace !
But I get ths following error message, so, what caI do ?

-------------------------------------------------------------------------
Undefined                       first referenced
 symbol                             in file
gethostbyname                       /var/tmp/cca000t71.o
ld: fatal: Symbol referencing errors. No output written to a.out
---------------------------------------------------------------------------------

Andrew
0
Comment
Question by:andrewyu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 2

Accepted Solution

by:
seedy earned 0 total points
ID: 1296238
Man page for 'gethostbyname' states:
   cc  [ flag ... ] file ... -lnsl [ library ...]

You need to link the 'nsl' library!
Cheers,
-Seedy-

0
 
LVL 2

Expert Comment

by:seedy
ID: 1296239
Andrewyu,

Please let me know why you rated this answer or the previous
one - 'DNS' under Unix Programming as 'C'?
Would you have liked anything else too?

you answering this would help me help others better.
Cheers.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1296240
It doesn't appear that andrewyu has ever graded any answer.
0
 
LVL 2

Expert Comment

by:seedy
ID: 1296241
Oops!  Was this auto-graded?  How can I find the difference?
0
 

Expert Comment

by:Johannne1
ID: 24989403
I got the above solution but I also had to add lsocket.

gcc -lsocket -lnsl myprogram.c
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question