c++ - Including libraries in G++ using -l confusion -
i'm trying use external library i'm confused how fits together.
i have following code i'm trying compiled:
#include "cryptopp/sha.h" int main() { cryptopp::sha1 sha1; return 0; }
i'm using g++ compiling, , research i've gathered need append
-lcryptopp
to end of compile command so:
g++ crypto.cpp -o crypto.exe -lcryptopp
but following error:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcryptopp
this confused, i'm not sure -lcryptopp looking for, looking sha.cpp/sha.h files i'm including in code? more importantly how specify whatever it's looking want in cryptopp folder in same folder main .cpp?
-lcryptopp
tells linker link exe against dynamic library (shared object) file libcryptopp.so
. gnu linker searches shared object files in various directories /lib
, /usr/lib
, others.
you can specify additional directories search library files -l
option, -l/usr/local/lib
. should find out library file libcryptopp.so
located , pass path -l
option.
Comments
Post a Comment