Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ld: fatal: Symbol referencing errors!

Status
Not open for further replies.

aboujouj83

IS-IT--Management
May 9, 2003
52
US
After compiling a client.c C code, I am getting the following message:

Undefined first referenced
symbol in file
max /var/tmp/cc56aOlv2.o
Inet_pton /var/tmp/cc56aOlv1.o
ld: fatal: Symbol referencing errors. No output written to prog1

The code is long, I will provide it later if I don't get any answer. Note that I included in a header file all the necessary libraries including the <netinet/in.h> which defines the Inet_pton variable.
I don't understand what the messages refers too and how to correct it. Is it a libary missing (which i doubt) or something else?

Waiting for your clarifications.

Aboujouj
 
Which operating system and compiler are you using?
 
Including the header files is not enough - the include files just provide function prototype definitions etc for the source code to keep the compiler happy - they do not assist the compiler (or more correctly the link editor) to include the binary code for the function in the binary for your program. For this to happen you have to instruct the compiler / link editor to include the relevant library modules.

Refer to the -l and -L command line switches if using gcc (I deduce from the /var/tmp in your output that you are on some form of *nix)

 
1) Comple with a -l with a specific library added to it.
2) use the command 'nm' to decipher if that symbol is really 'Defined' in that library ( and not merely an 'Extern' or 'Undef'). Some time you get wrong libraries as well.

-Sesha

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top