C++ 的 Sublime Text 自动完成插件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40730405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sublime Text autocomplete plugin for C++?
提问by DevX10
I'm trying to have the autocomplete feature on Sublime Text by using c++ libraries. I use very often EIGEN for example, but there is no autocomplete for functions inside this library. How can I somehow export the library to let sublime know about all the functions and methods I could use within this library?
我正在尝试使用 C++ 库在 Sublime Text 上拥有自动完成功能。例如,我经常使用 EIGEN,但此库中的函数没有自动完成功能。我怎样才能以某种方式导出库,让 sublime 知道我可以在这个库中使用的所有函数和方法?
I would appreciate any helpful answer.
我将不胜感激任何有用的答案。
回答by jdhao
I use the package EasyClangCompleteto auto-complete C++ code. And it works fine.
我使用EasyClangComplete包来自动完成 C++ 代码。它工作正常。
You can install this package using Package Control
. It is easy to set it up, a working setting is as follows:
您可以使用Package Control
. 设置很容易,工作设置如下:
{ "common_flags" : [
// some example includes
"-I/usr/include",
"-I$project_base_path/src",
// this is needed to include the correct headers for clang
"-I/usr/local/lib/clang/4.0.1/include", ], "cpp_flags" : [
"-std=c++11",
"-Wall" ],
"errors_style": "phantoms",
"hide_default_completions": true,
"progress_style": "ColorSublime",
"show_type_info": false,
}
回答by jreed
If you are using Sublime Text 3, what you're looking for is a plugin like ClangAutoComplete
如果您使用的是 Sublime Text 3,那么您正在寻找的是像ClangAutoComplete这样的插件
Documentation can be found here
文档可以在这里找到
回答by Paul Fultz II
You can use ClangComplete, which will use libclang for code completions.
您可以使用ClangComplete,它将使用 libclang 进行代码完成。