The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Symbol referencing error fromatz High Level Programming 1 03-17-2008 03:01 PM
C++ Compiling error.. Symbol Reference bjena UNIX for Advanced & Expert Users 3 08-08-2006 11:10 PM
ld: fatal: Symbol referencing errors. No output written to SNX jerryragland High Level Programming 1 08-08-2006 10:15 PM
symbol referencing error suhasini High Level Programming 1 04-03-2006 03:43 AM
ld: fatal: Symbol referencing errors alfabetman UNIX for Dummies Questions & Answers 2 01-08-2002 01:57 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 07-11-2001
Registered User
 

Join Date: Jun 2001
Posts: 10
Question Compiling Errors -- Symbol referencing

I'm trying to compile a FTP_API program. To do this you must use the libftp.so libary. But that libary has references which are not defined. Has anyone had this problems and how is it corrected??

The command line looks like this:--------------------------------------------
# cc ftpstock.c -lftp
Undefined.........................first referenced
symbol..............................in file
_xlisten............................./udk/usr/lib/libftp.so
_xbind.............................../udk/usr/lib/libftp.so
_xsetsockopt ..................../udk/usr/lib/libftp.so
_xconnect........................../udk/usr/lib/libftp.so
gethostbyname................./udk/usr/lib/libftp.so
_xaccept............................/udk/usr/lib/libftp.so
getservbyname................../udk/usr/lib/libftp.so
inet_ntoa.........................../udk/usr/lib/libftp.so
_xsocket............................./udk/usr/lib/libftp.so
inet_addr............................/udk/usr/lib/libftp.so
_xgetsockname................../udk/usr/lib/libftp.so
UX:ld: ERROR: a.out: fatal error: Symbol referencing errors. No output written to a.out
-------------------------------------------------------------------------------

Want do you guys think? I have stdio.h and net/libftp.h included in the file.

Thanks,
Mike


Last edited by spotanddot; 07-11-2001 at 06:39 AM.
Reply With Quote
Forum Sponsor
  #2  
Old 07-11-2001
Neo's Avatar
Neo Neo is offline
Administrator
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 4,441
libftp.so needs the socket libaries. There was a thread recently with the same exact problem and the -lsocket or -lsock linker option was described. Sound like you need to link the socket libs.
Reply With Quote
  #3  
Old 07-11-2001
Registered User
 

Join Date: Jun 2001
Posts: 10
I've done that and two different functions that have no references which are not defined pop up. It's an endless circle.

__use_iks_version.................../udk/usr/lib/libsocket.so
_set_use_iks_version............../udk/usr/lib/libsocket.so


Tkanks neo,

Mike
Reply With Quote
  #4  
Old 07-11-2001
Neo's Avatar
Neo Neo is offline
Administrator
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 4,441
No, it is not an endless circle, it is a straight line making sure that all the libraries are linked during the linking phase -- pretty much one of the core architecturals constructs of C programming. Finding all the libraries takes time if you have not used them before. After using them; it gets easier

Having said that, I am not sure which libs have the symbols you are missing in the sockets library. What version of UNIX are you working with and what is the compiler?
Reply With Quote
  #5  
Old 07-11-2001
Registered User
 

Join Date: Jun 2001
Location: USA
Posts: 21
Similar case

Did you try with
cc progra.c -lsocket -lnsl

not sure whether this will help you

thanks
Reddyb
Reply With Quote
  #6  
Old 07-11-2001
Registered User
 

Join Date: Jun 2001
Posts: 10
Thanks guys,

reddyb--
including -lnsl worked!!!!

Thanks again,
Mike
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0