I've seen this article and learned that:
- Directories specified on the command line with
-L
option are searched before the default directories. - The directories specified in
-L
are searched in the order in which they are specified on the command line.
The question is: Is there an search order for the default directories?
For example, if I run this command:
$ gcc -Xlinker --verbose 2>/dev/null | grep SEARCH | sed 's/SEARCH_DIR("=\?\([^"]\+\)"); */\1\n/g' | grep -vE '^$'
(command copied from this article)
it prints out /usr/local/lib
before /usr/lib
in my machine (Ubuntu 16.04, 64-bit, gcc 5.4.0). In this case, will /usr/local/lib
be searched before /usr/lib
?