A simple problem regarding shared libs...
Venkatakrishnan, V
V.Venkatakrishnan@channels.usa.xerox.com
Fri Feb 8 10:38:00 GMT 2002
Hi,
I created a static library file out of the same shrobj.o by saying
Ar rv libstatic.a shrobj.o
and then linked that to my program saying
Gcc hello.o -L. -lstatic -o Hello
and it worked.
Looks like there's something fishy 'bout my LD_LIBRARY_PATH. Any
idea anybody?
Regards,
Venky
-----Original Message-----
From: Venkatakrishnan, V [mailto:V.Venkatakrishnan@channels.usa.xerox.com]
Sent: Friday, February 08, 2002 1:20 PM
To: 'John Love-Jensen'; gcc-help@gcc.gnu.org
Subject: RE: A simple problem regarding shared libs...
Hi Eljay,
Hmmmm, I did echo $LD_LIBRARY_PATH and I didn't get anything (just
got my # prompt back) and then did set LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH,
did echo again and didn't get anything, could it mean that my variable is
not set?
I tried gcc hello.o -L. -lshared -o Hello again after that but got
the same error message.
Regards,
Venky
-----Original Message-----
From: John Love-Jensen [mailto:eljay@adobe.com]
Sent: Friday, February 08, 2002 12:49 PM
To: Venkatakrishnan, V; gcc-help@gcc.gnu.org
Subject: Re: A simple problem regarding shared libs...
Hi V,
Have you set your LD_LIBRARY_PATH?
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
Sincerely,
--Eljay
Hi,
I've these two files.....
Hello.c
#include <stdio.h>
Extern const char* func();
Int main( void)
{
printf("Hello World");
func()
return 1;
}
Shrobj.c
Const char* func(void)
{
printf("Hello from shared lib");
}
I do the following to create the obj files..
Gcc -c hello.c
Gcc -c shrobj.c
and then to create the shared lib I do
Gcc shrobj.o -shared -o libshared.so
this gives me the shared lib.
Now I try to compile my program hello.o with this shared lib by
saying Gcc hello.o -L. -lshared -o Hello
but this gives me an error saying.....
Ld: 0706-006 Cannot find or open library file: -l shared
ld:open(): A file or directory in the path name does not exist.
Collect2: ld returned 255 exit status
Why is this happening? My shared lib. Is right there and I've also
given -L. to look for it in the current directory.
Any help please.
Regards,
More information about the Gcc-help
mailing list