How to get SublimeClang, https://github.com/quarnster/SublimeClang, going on OS X
First step clone SublimeClang repo into your Sublime package directory.
# git clone https://github.com/quarnster/SublimeClang.git
# cd SublimeClang
# git pull && git submodule foreach --recursive git pull origin master
Next step is to compile libcache.dylib from SublimeClang/src. There is a cmake project for doing this but I never got it to work and as it seems to be only one file, it is farly easy to figure this out. And don't get fooled this is not the same as the libcache.dylib that is available in the system.
# cd src
# clang++ -dynamiclib -I. -DSUBLIMECLANG_VERSION=\"1.0.41\" -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ -lclang -std=c++11 main.cpp -o libcache.dylib
# cp libcache.dylib ..
Next is to fixup the SublimeClang config. The default is for an ancient version of toolchain so it needs to be changed. If you are on a different version then I am, you get all the paths by compiling a file with -v like clang++ -v yourfile.cpp.
diff --git a/SublimeClang.sublime-settings b/SublimeClang.sublime-settings
index 1b510f3..26c71db 100644
--- a/SublimeClang.sublime-settings
+++ b/SublimeClang.sublime-settings
@@ -148,3 +148,3 @@
// For example, you can use "c++": ["-std=c++11"] to enable C++11 features.
- "c++" : [],
+ "c++" : ["-std=c++11"],
"c": [],
@@ -272,5 +272,8 @@
[
- "-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/",
- "-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1",
- "-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/",
+ "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk",
+ "-isystem", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1",
+ "-isystem", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include",
+ "-isystem", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
+ "-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include",
+ "-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/",
"-Wno-deprecated-declarations",
@@ -304,3 +307,3 @@
// included headers
- "dont_prepend_clang_includes": false,
+ "dont_prepend_clang_includes": true,
Thank you so much for sharing how to compile
libcache.dylib
. It works for me. However, there should be one more step of copyinglibclang.dylib
.BTW, the following config works for me on OS X 10.11
However, it seems that SublimeClang can't provide completion for
unique_ptr
. Could you give it a try?