2

Recently, I shifted to Sublime text editor from VS Code. In VS code I use C/C++ extension by Microsoft for C++ autocompletion.

I go through the steps given in https://github.com/niosus/EasyClangComplete.

I am able to do the first 2 steps but step 3 that is Configure your compiler flags and include folders confused me. How can I be able to successfully install this plugin?

am2505
  • 2,194
  • 15
  • 19

1 Answers1

3

Step1: To install EasyClangComplete, first you need to have Package Control. Then press following

CTRL+Shift+P for Windows
CMD+Shift+P  for MacOS

Now search Package Control: Install Package and press enter. Then search EasyClangComplete and install it.

Step2: Need to install Clang

Ubuntu  : sudo apt-get install clang
MacOS   : By default installed. You are all set!
Windows : install the latest release from clang website.

To check if it successfully installed

clang --version

Step3: Configure your compiler flags and include folders.

For this step, you just need to create 2 empty files in your project root folder.

CMakeLists.txt
compile_commands.json

Now, restart sublime text editor and auto-completion feature will work successfully.

If this doesn't work, you need to do 1 more step.

Go to Package Setting > EasyClangComplete > Settings. Now add following code in file "EasyClangComplete.sublime-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",
  ],
}
am2505
  • 2,194
  • 15
  • 19