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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
jkrCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
evilrixSenior 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.