On my OpenBSD 6.1/amd64
system, the default header file search path of cc
compiler is only /usr/include
:
# echo | cc -E -Wp,-v -
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
The default library search path is only /usr/lib
:
# cc -Xlinker --verbose 2>/dev/null | grep SEARCH | sed 's/SEARCH_DIR("=\?\([^"]\+\)"); */\1\n/g' | grep -vE '^$'
SEARCH_DIR("/usr/lib");
So if you want to include other header file or link libraries in other directory, you need to specify it explicitly. For example:
# cc -I/usr/local/include -L/usr/local/lib ...
Reference:
Finding out what the GCC include path is;
How to print the ld(linker) search path.