LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
LinkBack Search this Thread
Old 11-18-2007, 09:58 AM   #1
vijaya_svk
Member
 
Registered: Nov 2007
Posts: 61

Rep: Reputation: 15
how to create shared libraries and configure shared object location


Hi
I have created a shared library using the following command...

$gcc -shared -o libshared.so.1.0.0 1.o 2.o 3.o

and it got executed and i have got the shared library libshared. Now i am running my program with

$gcc prog.o -L. libshared.so.1.0.0

and got executed, now if i run ./a.out i am getting error as

./a.out: error while loading shared libraries: libshared.so.1.0.0: cannot open shared object file: No such file or directory

Please tell me how to create shared libraries, configure the paths and run my program.
 
Old 11-18-2007, 11:04 AM   #2
iwasapenguin
Member
 
Registered: Jul 2007
Posts: 110

Rep: Reputation: 15
That was a good try and reminds me of myself when I was younger (by about three weeks).
The compiler flag -L is used for indicating the directory that the shared libraries are in.
If you want to include the actual object use -L. -lsharedlib (that's a little 'l' not a 1) or something to that effect (haven't got used to yet either ).
 
Old 11-19-2007, 12:30 PM   #3
vijaya_svk
Member
 
Registered: Nov 2007
Posts: 61

Original Poster
Rep: Reputation: 15
Hi
I have used the same what u have said and the problem is repeating...
i think some env variables are to be exported, i dont know how to do it, can u please tell me... or any other solution.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: Franziss Linux - Newbie 10 06-28-2010 05:47 AM
[SOLVED] How to build a shared object from other libraries (linking statically)? eantoranz Programming 4 10-26-2007 12:19 PM
Retrieving location of shared object file (Linux, C++) ? fantas Programming 4 06-08-2007 06:18 AM
error while loading shared libraries: libgvc.so.3: cannot open shared object file coolrock Slackware 6 01-17-2007 05:10 PM
error while loading shared libraries: libdb-4.1.so: cannot open shared object file putquery8581 Linux - Software 1 10-01-2004 07:03 AM


All times are GMT -5. The time now is 11:38 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration