Static and Dynamic/Shared Linking with MinGW
I want to start with a simple linking usage to explain my problem. Lets assume that there is a library z which could be compiled to shared library libz.dll(D:/libs/z/shared/libz.dll) or to static library libz.a (D:/libs/z/static/libz.a). Let I want to link against it, then I do this: gcc -o main.exe main.o -LD:/libs/z/static -lz According to this documentation , gcc would search for libz.a, which is archive files whose members are object files I also can do the following: gcc -o main.exe main.o -LD:/libs/z/shared -lz It is not mentioned in the documentation above that -l flag will search for