LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-15-2009, 09:49 PM   #1
Al Effendi
LQ Newbie
 
Registered: Dec 2003
Posts: 8

Rep: Reputation: 0
link multiple libraries


Hi,

Thanks in advance

how can i link multiple libraries not diff. versions
eg. C library + others

Appreciate help

thanks
al
 
Old 03-15-2009, 10:00 PM   #2
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 49
I am not sure what you mean by "link". Like in linking a program to a .so/.la file?

In that case, assuming you are using gcc, you just send the -l flag as many times you want:

gcc file.cpp -o program -lmath -lpthread -lsomeotherlibrary
 
Old 03-15-2009, 10:59 PM   #3
JaksoDebr
Member
 
Registered: Mar 2009
Distribution: Fedora, Slackware
Posts: 104

Rep: Reputation: 21
There is a difference between linking static libraries and shared libraries. Here is a sample from a Makefile:

Quote:
INCS=-I/usr/include/GL -I.
LIBS=-lm -lGL -lGLU
AUXLIBS=./libaux.a ./libtk.a

cube:
gcc -c openglbk_0/cube.c $(INCS)
gcc -o cube cube.o $(AUXLIBS) $(LIBS)
@echo "done cube build"
Static lib usually end with .a, shared libs tend to use the .so naming convention. Shared libs are prefixed with '-l', and a libfile name 'libGL' is used as '-lGL' (note: 'lib' is omitted in the usage). Static libs are simply defined by their pathname.

JD

Linux Archive

Last edited by JaksoDebr; 04-02-2009 at 06:10 AM.
 
  


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
How to link external c++ libraries? Asuralm Programming 3 11-06-2007 09:43 AM
How to link libraries with g++ [KIA]aze Programming 1 04-13-2007 04:38 AM
link non-default libraries in KDevelop?? TLV Programming 3 12-14-2004 12:25 PM
Dynamic link libraries eshwar_ind Programming 1 05-10-2004 12:02 AM
gaim trying to link static and shared libraries rose_bud4201 Linux - Software 0 09-28-2003 01:27 AM


All times are GMT -5. The time now is 07:14 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration