mac 环境下sublime text2安装sublimeClang (c/c++)


参考:

1)http://fduo.org/use-sublimeclang-for-objc-dev/ (使用SublimeClang在Sublime Text 2中进行Objective-C开发)

2)https://github.com/quarnster/SublimeClang (官网)


安装环境 MAc

首先可以根据官网的步骤安装,但是要说明下官网已经说了“Plugin discontinued” ,就是已经不再更新了,新的维护在https://github.com/quarnster/completion, 看了下是用go语言的编的,现在(20130611)还是可以使用的。


注意:下面的install package方式我这边安装失败,(其实就是立马提示安装成功,其实package 根本没有sublimeClang的目录);可以使用手动安装方式;

Installation

  1. The easiest way to install SublimeClang is via the excellent Package Control Plugin. Note that SublimeClang doesn't install correctly with version v1.6.3 of Package Control; either use the latest testing version or (if it exists) a newer stable version of Package Control.
    1. See http://wbond.net/sublime_packages/package_control#Installation
      1. Once package control has been installed, bring up the command palette (cmd+shift+P or ctrl+shift+P)
      2. Type Install and select "Package Control: Install Package"
      3. Select SublimeClang from the list. Package Control will keep it automatically updated for you
    2. If you don't want to use package control, you can manually install it
      1. Go to your packages directory and type:
        1. git clone --recursive https://github.com/quarnster/SublimeClang SublimeClang
        2. After this you'll have to Compile libcache as described in the Additional Prerequisites (Linux Only) section
      2. To update run the following command:
        1. git pull && git submodule foreach --recursive git pull origin master
  2. Back in the editor, open up the command palette by pressing cmd+shift+P or ctrl+shift+P
  3. Type SublimeClang and open up the settings file you want to modify with any include directories or other options you want to provide to clang.


上面说的“After this you'll have to Compile libcache as described in the Additional Prerequisites (Linux Only) section”,你可以按照下面的步骤安装,见下;

cd src

mkdir build

cd  build

cmake ..

(如果没有安装cmake ,可以sudo brew install cmake 安装)

make

安装最后一个步骤

编辑打开Command Plaette,找到Preferences: SublimeClang Settings - User

{
    "options":
    [
            "-Wall",
            "-I/usr/lib/clang/4.2/include/**",
            "-I/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include/"
    ]
}



好了,可以使用了;







你可能感兴趣的:(sublime)