Hi, I’m trying to set the includes search path in clang, but I can’t figure out how to do it? I’m working on OSX and every time I compile a C/C++ code, I have to specify it with -isysroot (and I don’t want an alias, or a symlink to /usr/include) since the includes are not in a really standard path on OSX (e.g.: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++). Is there a way to do that? Thx
I think the libc++ folks recommend building libc++ along with clang. If you do that, the c++ includes files will get copied under the relative include path and will be found automatically. However, you'll need to set DYLD_LIBRARY_PATH in order to pick up the correct, just built, libc++ library. But if you really do want to use the installed version of libc++, you can use xcrun to dynamically find the path via xcrun and set CPLUS_INCLUDE_PATH. $ export CPLUS_INCLUDE_PATH=$(dirname $(xcrun -f clang))/../include/c++/v1 On Mon, Oct 12, 2015 at 10:13 AM, Rinaldini Julien via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > I’m trying to set the includes search path in clang, but I can’t figure > out how to do it? > > I’m working on OSX and every time I compile a C/C++ code, I have to > specify it with -isysroot (and I don’t want an alias, or a symlink to > /usr/include) since the includes are not in a really standard path on OSX > (e.g.: > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++). > > Is there a way to do that? > > Thx > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151012/f29a0ebd/attachment.html>
Hi! I saw the CPLUS_INCLUDE_PATH variable in the code but wasn’t sure how to use it. I’ll try that. Thanks> On 12 Oct 2015, at 18:00, don hinton <hintonda at gmail.com> wrote: > > I think the libc++ folks recommend building libc++ along with clang. If you do that, the c++ includes files will get copied under the relative include path and will be found automatically. However, you'll need to set DYLD_LIBRARY_PATH in order to pick up the correct, just built, libc++ library. > > But if you really do want to use the installed version of libc++, you can use xcrun to dynamically find the path via xcrun and set CPLUS_INCLUDE_PATH. > > $ export CPLUS_INCLUDE_PATH=$(dirname $(xcrun -f clang))/../include/c++/v1 > > > > On Mon, Oct 12, 2015 at 10:13 AM, Rinaldini Julien via llvm-dev <llvm-dev at lists.llvm.org> wrote: > Hi, > > I’m trying to set the includes search path in clang, but I can’t figure out how to do it? > > I’m working on OSX and every time I compile a C/C++ code, I have to specify it with -isysroot (and I don’t want an alias, or a symlink to /usr/include) since the includes are not in a really standard path on OSX (e.g.: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++). > > Is there a way to do that? > > Thx > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >