Yes, the -L option adds the search path, but the linker adds the suffix .so (or .a ) itself (as .a lib prefix). So you need to have -lchaiscript_stdlib-5.3.1 , and the linker will find it.
You can also skip adding the path and link it directly to the file:
clang++ Main.cpp -o foo libchaiscript_stdlib-5.3.1.so
Note that the runtime linker (which actually loads the shared libraries when your program starts) may not be able to find the library if it is not in the path of the runtime linker. You can specify the linker (compilation time) to add the path to the shared library path in the generated program:
clang++ Main.cpp -o foo libchaiscript_stdlib-5.3.1.so -Wl,-rpath,/absolute/path
The -Wl option tells the compiler to pass the option to the linker, and the -rpath linker -rpath adds the path to the search path in the runtime.
source share