1

I'm trying to compile some code and it seems as though it can't find header files because the /usr/local/lib directory isn't included in the clang search paths.

$ echo | clang -v -E -x c++ -stdlib=libc++ -
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.3.0
Thread model: posix

... <SNIP> ...
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks (framework directory)
End of search list.

As you can see both /usr/include and /user/local/include don't exist. Is there a configuration I can change somewhere to include these directories?

aMat
  • 305
  • 1
  • 2
  • 10
  • For a simple fix, use the `-I/usr/local/include -I/usr/include` compiler flags. But `/usr/include` should really be default; not sure what's up with Apple doing that differently. –  Jan 09 '17 at 21:19
  • Yea it seems like my `ld` search paths are also screwed up... is there a way to look up the search paths for `ld` ? – aMat Jan 09 '17 at 22:36
  • I don't know a similar command for `ld`. –  Jan 10 '17 at 07:55
  • Fwiw, I'm on El Capitan, with the exact same clang version, and I do see `/usr/include` and `/usr/local/include`. –  Jan 10 '17 at 07:56
  • 1
    Does the answer to [this related question from the sidebar](http://stackoverflow.com/questions/23905661/on-mac-g-clang-fails-to-search-usr-local-include-and-usr-local-lib-by-def?rq=1) help? –  Jan 10 '17 at 07:56

0 Answers0