Q:

Including libraries in G++ using -l confusion

I'm trying to use an external library but I'm confused how it all fits together.
I have the following code that all I'm trying to do is get compiled:
#include "cryptopp/sha.h"

int main()
{
    CryptoPP::SHA1 sha1;
    return 0;
}

I'm using g++ to do the compiling, and from my research I've gathered that I need to append 
-lcryptopp

to the end of the compile command like so:
g++ crypto.cpp -o crypto.exe -lcryptopp

but I get the following error:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcryptopp
This is where I get confused, I'm not really sure what the -lcryptopp is looking for, is it looking for the sha.cpp/sha.h files that I'm including in my code? But more importantly how do I specify that whatever it's looking for I just want it to look in the cryptopp folder in the same folder as my main .cpp?

A:

-lcryptopp tells linker to link your exe against the dynamic library (shared object) file libcryptopp.so. GNU linker searches for shared object files in various directories like /lib, /usr/lib and others.
You can specify additional directories to search for library files with -L option, like -L/usr/local/lib. You should find out where is your library file libcryptopp.so located and pass the path to it with -L option.

