Compile/Link on Unix question
Posted on 2013-11-18
Hi, I wonder if you can help me with a development issue related to "libcurl". I am an experienced Windows developer but I need to do something on a BSD Unix system, and I am basically a novice with that. I am trying to write a C program that links with this
open source library for doing http requests. I have uploaded the libcurl tar file, uncompressed it, and I believe I successfully built the library. I have the directory /home/comaxis/curl/lib in which are contained the files libcurl.a, libcurl.la, libcurl.so, and libcurl.so.7. From the directory /usr/home/comaxis, I use the command:
cc demo.c -Lcurl/lib -lcurl, and receive no errors. But when I try to run a.out, I get the
error "Shared object libcurl.so.7 not found, required by a.out".
Now, following directions from the libcurl web site, I do instead:
cc demo.c /Lusr/local/lib -lcurl. The executable produced by that works fine.
The problem is that the libcurl version that is in /usr/local/lib is older, and I would prefer to use the version that I just made. What is the problem?
Another question, I don't really understand what I am doing with the -l switch. There is nothing in the directory that I specify named "curl" - so how does the link even work?