Operating System - Linux
1753776 Members
7284 Online
108799 Solutions
New Discussion юеВ

Re: Problem in linking a shared Library

 
SOLVED
Go to solution
CA1490051
Frequent Advisor

Problem in linking a shared Library

Hi All,

I am trying to link a shared library libzlib.sl present in /opt/hpws/

So i gave following command
aCC -o -L/opt/hpws HelloWorld HelloWorld.cpp -lzlib

It says
/usr/ccs/bin/ld cant find library zlib

I also tried copying the lib file into my current directory and giving following command
aCC -o -L. HelloWorld HelloWorld.cpp -lzlib

But same error continues.

Can any one help me out please

I have set SHLIB_PATH and also CCLIBDIR Environment variables Path to the zlib path but still error continues.

thanks and regards
Vikram


2 REPLIES 2
Srimalik
Valued Contributor
Solution

Re: Problem in linking a shared Library

Try this:
aCC -o HelloWorld HelloWorld.cpp -L/opt/hpws -lzlib

abandon all hope, ye who enter here..
Dennis Handly
Acclaimed Contributor

Re: Problem in linking a shared Library

>I am trying to link a shared library
aCC -o -L/opt/hpws HelloWorld HelloWorld.cpp -lzlib

Your problem is that -o takes a file and eats up the -L. Use:
-L/opt/hpws -o HelloWorld ...

Or better yet as Srikrishan said, move the -L to the end.