How to link libraries with g++
I am trying to compile a program using certain libraries.
Among the libraries are ".o", ".lo", ".Plo", "lib*.la", "lib*.so" files organized in several folders. What is the difference between them and how do I load them with g++? I read the g++ manual but I didn't really understand the difference between the options -L and -l: Quote:
I had no problems including the header files with -I. The problem are the libraries. |
When you use option -L you specify the directory where linker can find library files.
When you use option -l you specify the name of library file. It may be different from "lib*.a". If its name is different, just write full name of library file. For example, name of the library file is "myownlib.a" than you specify option like: -lmyownlib.a if the name of library is "libmyown.a" than option will be: -lmyown As for your question about difference between types of library, the lib*.a is a static library. This type of library is added to executive file. The lib*.so is a shared library, which dynamically linked during executing of program. Hope it helps you! |
All times are GMT -5. The time now is 11:42 AM. |