Default libraries linked in by gcc?

The -v option to gcc will cause it to dump information about the default options it will use including the library paths and default libraries and object files that will be linked in.

If you give the -Wl,--verbose option, gcc will pass the --verbose to the linker which will dump exactly where it’s looking for libraries, including both failed and successful searches.

Combine both options, and you’ll see exactly what libraries are linked in, and why they’re being linked in.

gcc -v foo.c -Wl,--verbose

Leave a Comment