la to so (how to convert a library and then link to execution (GSL)

Hello

I am trying to use the GNU general scientific library (GSL). I am using Linux (Fedora 7). I have the library tucked away in /usr/local/lib directory. The library is 'libgsl.la'  What key strokes do I use from the command line to convert the library to 'so' format. I assume one uses libtool, but I keep messing up in some fashion.

Then once that is done and say I wish to run a program 'math_prob.cpp' what are the keystrokes from the command line to first create the .o file and then the keystrokes to execute the o file such that the gsl library is linked?
The GSL is written in c  My standalone code is in C++  (use G++).

So, I need help on what might be very elementary.

Thanks LD

lwdalton3Asked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
As evilrix probably tried to communicate, there is not much of a difference in the output of libtool or ar - see also http://www.gnu.org/software/libtool/manual.html and be sure you have a gcc/g++/ld version that supports the alternative extensions.
0
 
evilrixSenior Software Engineer (Avast)Commented:
Not sure about your libtool Q; however, here is how to compile your source file and link it to gsl...

g++ -o math_prob math_prob.cpp -L <path to libgsl.la> -l gsl

This will compile your source file, link in the gsl library and generate a binary called math_prob in the current working directory. To execute it you then type ./math_prob at the shell prompt.

-Rx.
0
 
evilrixConnect With a Mentor Senior Software Engineer (Avast)Commented:
>> there is not much of a difference in the output of libtool
The Q is, why do you want to convert the static library to a DSO (Dynamic Shared Object)? Unless there is a compelling reason to do so I just wouldn't bother. It there is a compelling reason you might be better off just looking for and installing a pre-compile DSO version of this library.

http://rpmfind.net/linux/rpm2html/search.php?query=libgsl.so
0
 
lwdalton3Author Commented:
The combination of the web page and comments solved the problem. Yes I kept the .la. But mainly I found the boost libraries to have what I wanted and easier to use. I appreaciate the rapidity of the answers. Thanks Les
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> I found the boost libraries
Boost rocks :)
0
All Courses

From novice to tech pro — start learning today.