LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 08: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, 09:00 PM   #2
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 50
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
 
1 members found this post helpful.
Old 03-15-2009, 09: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 05:10 AM.
 
  


Reply



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

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

All times are GMT -5. The time now is 10:33 PM.

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