Hi All, I have two existing shared libraries liba.so, libb.so. Liba.so depends on libb.so(liba.so is dynamically linked with libb.so ). Now I want to compile an application which uses both liba.so and libb.so. 1. On Linux, following command can pass gcc -Wall -o app app.c -L.. -la Note: -lb is not specified in the command I have several questions: 1). How is libb.so also linked actually while dynamic linking liba.so? It seems the linker knows libb.so according to the NEEDED entry in dynamic section of liba.so(which contains the name of libb.so)? Dynamic symbol table is also used to resolved symbols during linkage stage of compile, right?(since the program still can compile if the shared libraries are stripped) Explanation of detailed workflow is welcomed. 2) With -la or without -la We have two choices: i) gcc -Wall -o app app.c -L.. -la ii) gcc -Wall -o app app.c -L.. -la -lb Which one is more preferred? ii) is better for me, since it can indicate the dependency clearly; another reason is, make sure it can compile on different platforms, which I will address in the following section. 2. On Cygwin, while, the same command can not pass gcc -Wall -o app app.c -L.. -la (same as on Linux, no -lb ) The error report reads like this: undefined reference to xxx(symbols defined in libb.so) Questions: What's the difference between gcc's behaviors on Linux and Cygwin? Thank you, Ly