LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2003, 12:18 PM   #1
dhanakom
LQ Newbie
 
Registered: Jul 2003
Location: Birmingham
Posts: 20

Rep: Reputation: 0
Exclamation Linking errors


Hello everyone,

when I attempt to run my c++ program, I get a linking error

/usr/bin/ld: -lXft not found

my makefile contains a line X-Lib: ..........,-lXft,..........,-lXmc.

when i search for those lib files, i find that all the files in the above line are present as .a files in /usr/lib whereas the one that it complains Xft has a symbolic link to it in the directory /usr/lib.

Can someone tell me how to get around this problem.

Can someone also tell me what is the difference between .a and .so files.
 
Old 07-07-2003, 04:03 PM   #2
vladkrack
Member
 
Registered: Oct 2002
Location: Curitiba - Brazil
Distribution: Conectiva
Posts: 334

Rep: Reputation: 30
Hi,

The files with extension .a are static libs, and .so are dynamic libs ...

Are you trying to compile your program or execute it? To compile it you will need to use te devel libs ...
 
Old 07-07-2003, 05:19 PM   #3
0x4B
Member
 
Registered: May 2003
Location: Nashville TN, USA
Distribution: Debian (I'm unstable)
Posts: 117

Rep: Reputation: 15
I believe the .a files are archives actually.
ar t <filename>.a
should show you a list of .o files contained in it
.so are shared objects (for dynamic linking) while .o can only (?) be used in static linking
 
Old 07-07-2003, 05:21 PM   #4
dhanakom
LQ Newbie
 
Registered: Jul 2003
Location: Birmingham
Posts: 20

Original Poster
Rep: Reputation: 0
Exclamation Linking errors

I'm trying to compile my program using my make file.

The only noticeable difference is that all other libraries listed in my make file exist in /usr/X11R6/lib as .a files and the library that creates the problem is present as .so file.

Earlier one of the library path in my makefile for FLTK (a GUI appln that I use along with VTK in my program) contained the following structure

FLTK-LIB: ..................... -libfltk, ......

when I compiled, when linking the program complained that it can't find -libfltk. In the fltk lib directory the name of the library file was libfltk, but for VTK eventhough the library files were named libVTK, in the make file the path was -lVTK. Therefore I decided to change -libfltk to -lfltk and it solved the problem.

I'am confused.

Thanks,
Murali.
 
Old 07-07-2003, 05:34 PM   #5
0x4B
Member
 
Registered: May 2003
Location: Nashville TN, USA
Distribution: Debian (I'm unstable)
Posts: 117

Rep: Reputation: 15
you mentioned that libxft was a symbolic link; does the destination of the link exist? if so, look in the make file for a line containing linker options -- often something like LDIR = <some dirs> where the CFLAGS line contains -L$(LDIR) -- and add in the location of the actual object (rather than the link). -L adds extra directories to the path that is search by the linker.
-l<blah> refers to the library blah, whether its a shared object, standard object, or archived object. the filename will have lib prepended to the front. -l is actually an option, and the blah is the argument value
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
linking problems - 'undefined reference' errors back2morrie Programming 1 06-14-2005 08:02 AM
Linking LS to 'L' uveraser Linux - General 2 05-20-2004 10:24 AM
Linking errors dhanakom Programming 4 07-08-2003 02:12 AM
linking problem with ld ! gluon Programming 2 05-19-2002 01:59 PM
C++ linking? ugenn Programming 5 05-14-2002 01:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration