最近,我从VS Code转到了Sublime文本编辑器。在VS代码中,我使用微软的C/C++扩展来实现C++的自动补全。
我按照中给出的步骤https://github.com/niosus/EasyClangComplete.
我可以完成前两个步骤,但第三步配置编译器标志并包含文件夹让我感到困惑。我如何才能成功安装此插件?
Step1:要安装EasyLangComplete,首先需要有Package Control。然后按下以下
CTRL+Shift+P for Windows
CMD+Shift+P for MacOS
现在搜索软件包控制:安装软件包并按enter键。然后搜索EasyLangComplete并安装它。
步骤2:需要安装Clang
Ubuntu : sudo apt-get install clang
MacOS : By default installed. You are all set!
Windows : install the latest release from clang website.
检查是否成功安装
clang --version
步骤3:配置编译器标志并包含文件夹。
对于这一步,您只需要在项目根文件夹中创建2个空文件。
CMakeLists.txt
compile_commands.json
现在,重新启动卓越的文本编辑器和自动完成功能将成功工作。
如果这不起作用,你需要再做一步
前往软件包设置>EasyLangComplete>设置。现在在文件"EasyLangComplete.spremie settings"中添加以下代码
{
"common_flags" : [
// some example includes
"-I/usr/include",
"-I$project_path/src",
// this is needed to include the correct headers for clang
"-I/usr/lib/clang/$clang_version/include",
// For simple projects, you can add a folder where your current file is
"-I$file_path",
],
}