Sublime插件“EasyClangComplete”如何配置?

Alaya-HY 发布于 2017/05/07 20:31
阅读 713
收藏 1

本人非科班自学CS中...最近心血来潮想试试搭建Sublime下的C++开发环境,之后便发现了这个Sublime的C++语法提示插件”EasyClangComplete“,苦于基础薄弱没有办法理解这一步配置,Google无果,自己研究了好一阵子也没有取得什么进展...于是来请教一下,恳请大家指点。插件原网址:niosus/EasyClaniosus/EasyClangCompletengComplete

平台为Windows

 

----------------------------------------------------

3. Configure your includes

Using CMake?

Plugin will run cmake on a proper CMakeLists.txt in your project folder and will use information from it to complete your code out of the box.

Have a compilation database?

Plugin will search for a compilation database compile_commands.json in the project folder and will load it to complete your code. If you want to specify a custom path to a comilation database you can do it in settings:

 

"flags_sources": [
    {"file": "compile_commands.json", "search_in": "<YOUR_PATH>"},
  ],

None of the above?

You will need a little bit of manual setup for now. Clang will automatically search for headers in the folder that contains the file you are working on and its parent. If you have a more sophisticated project you will need to help clang just a little bit. There are three ways to do it.

Pick ANY of the following:

  • Set include dirs in "common_flags" setting in User Settings:
    • See default settings to get started. These flags will be included in every project you run.
  • Add .clang_complete file to the root of your project folder.
    • This file should contain all includes and macroses you want to use.
    • Example file contents:
    • -Isrc -I/usr/include
  • Override "common_flags" setting in your project file! Just define the same setting in project specific settings with either one of two prefixes: "ecc_" or "easy_clang_complete_". See the project file in this repo for a working example. Minimal example for clarity: { "settings": { "ecc_common_flags": ["-Isrc", "-I/usr/include"], "easy_clang_complete_verbose": true } }

These settings are prioritized in a configurable way. Check out the settings to learn more about it.

That's it! You're ready to use the plugin!

加载中
返回顶部
顶部