Linking libraries

I

Ian

I've downloaded 3rd party libraries and I'm trying to link them in
with my code but when I use -l<library name> it gives me the error
"ld: cannot find -l<lib name>". When I link the libraries explicitly
it seems to work okay, ie by entering the full address to the library
on the command line or in the makefile. I'm running on Linux, I
resolved this problem before on a solaris OS by adding the address of
the library to the LD_LIBRARY_PATH but my env in Linux didn't have
this variable and when I added it, it made no difference. I also tried
running ldconfig as root with the new library directories explicitly
named but to no avail...

Any ideas??

Thanks in advance,
Ian
 
V

Victor Bazarov

Ian said:
I've downloaded 3rd party libraries and I'm trying to link them in
with my code but when I use -l<library name> it gives me the error
"ld: cannot find -l<lib name>". When I link the libraries explicitly
it seems to work okay, ie by entering the full address to the library
on the command line or in the makefile. I'm running on Linux, I
resolved this problem before on a solaris OS by adding the address of
the library to the LD_LIBRARY_PATH but my env in Linux didn't have
this variable and when I added it, it made no difference. I also tried
running ldconfig as root with the new library directories explicitly
named but to no avail...

Any ideas??

Command-line options are compiler-specific and as such are off-topic here.
Please consider posting to the compiler newsgroup. Often, platform NGs
are full of folks using the same compiler, so the OS newsgroups could also
be helpful.

<offtopic>
If your library is named "libBLAH.a" or "libBLAH.so", only use the BLAH
part in the command line. I.e. -lBLAH. Also RTFM about -L option.
LD_LIBRARY_PATH usually makes a difference for running apps, not linking.
</offtopic>

V
 
S

Steven T. Hatton

Victor said:
Command-line options are compiler-specific and as such are off-topic here.
Please consider posting to the compiler newsgroup. Often, platform NGs
are full of folks using the same compiler, so the OS newsgroups could also
be helpful.

<offtopic>
If your library is named "libBLAH.a" or "libBLAH.so", only use the BLAH
part in the command line. I.e. -lBLAH. Also RTFM about -L option.
LD_LIBRARY_PATH usually makes a difference for running apps, not linking.
</offtopic>

V

Not to mention LIBRARY_PATH for linking.
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top