Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-07-2003, 01:20 PM   #1
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, 01:49 PM   #2
LQ Guru
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153

Rep: Reputation: 45
Please don't double post
Old 07-07-2003, 03:04 PM   #3
LQ Newbie
Registered: Jul 2003
Location: Birmingham
Posts: 20

Original Poster
Rep: Reputation: 0
sorry, im a newbie

I'am extremely sorry, I dint know the rules.

Thanks for bringing to my notice the rules.
Old 07-07-2003, 07:01 PM   #4
Registered: Jun 2003
Location: SEUK
Distribution: Debian & OS X
Posts: 194

Rep: Reputation: 35
"when I attempt to run my c++ program, I get a linking error .... "

you mean when you link, as part of the building process, yes? (judging from the error)

Where is the link to libXft (.a or .so ) pointing and is the target present and correct (use ls -l)?

There no libX*.so files at all, anywhere?

The X libraries are often found in /usr/X11R[5 or 6]/lib/ - have a look to see what libraries are there and use -L/usr/X11R[5 or 6]/lib/ if so.

.a files are static libraries (archived object files) which will be linked into your program - if you have two copies of your program running then you get to copies in memory.
.so are shared libraries - which are loaded into memory once for all programs that use them (although any user needs to have these libraries installed on their system, and in the right version)

I think the switch to force linking to static libraries is -static (for gcc) but you might want to check the manual. Linking to shared libraries is normal.
Old 07-08-2003, 03:12 AM   #5
Registered: Jun 2003
Location: Oricola, Italy
Distribution: RH 9, so far
Posts: 261

Rep: Reputation: 31
Sometimes forcing to link to static library does not work. But I remember the option is -Bstatic. (Not sure).

The "/usr/bin/ld: -lXft not found" appears to me that the library "Xftlib.a" or .so could not be found by the linker. It is bettery to search for Xft*.* to see whether you have it.

I have another question to dhanakom: Sometimes the shared library has several "surfix" to ".so", like, or Would you tell me what this number mean?

Many thanks
Qu Chen


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 09:02 AM
Linking LS to 'L' uveraser Linux - General 2 05-20-2004 11:24 AM
Linking errors dhanakom Linux - Newbie 4 07-07-2003 06:34 PM
linking problem with ld ! gluon Programming 2 05-19-2002 02:59 PM
C++ linking? ugenn Programming 5 05-14-2002 02:33 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:41 AM.

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