1

I'm using Sublime Text 2 with SublimeClang. After upgraded to Mavericks / Xcode 5, SublimeClang stopped working. Static analyzer that calls command line clang still works fine, but the background diagnostic keeps complaining that it can't find iostream.

RichardLiu
  • 1,902
  • 1
  • 19
  • 18

2 Answers2

2

I had the same issue. I ended up solving it by re-installing the Xcode command line tools.

I ran this command in my terminal:

xcode-select --install

After that, SublimeClang seemed to work again.

Nathan Price
  • 63
  • 1
  • 6
1

It seems that Apple had updated clang in Xcode 5, and they have also dismissed the /usr/include path. For some mysterious reason, the new libclang.dylib in Xcode 5 does not recognize the default include path; it still tries to search /usr/include and usr/include/c++ for system header.

After checking with cpp -v, I've figured out that these include paths shall be included in the argument list when calling clang_parseTranslationUnit:

-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/
-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1
-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.0/include
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include

I can't put those arguments in the the "options" section of SublimeClang.sublime-settings, since it will be overridden by sublimeclang_options of each project. So I added these inside the additional_language_options section.

Now SublimeClang can finally work, not an ideal solution though. Anyone have better solutions ?

RichardLiu
  • 1,902
  • 1
  • 19
  • 18