Sublime Forum

ST3 as IDE for C Development

#1

Hi:
I am new to ST3. Is there a guide for beginners like me to set up sublime for C development. I have installed two plugins so far, CLang Format and EasyClangComplete. But when I tried to write a simple code, like start with #include statement, I do not see any autocomplete information about various include file options such as stdio.h etc. It appears that the default is C++ rather than C. I am new student to Computer Science, not an expert. Looking for guides to set up sublime on ubuntu, like eclipse IDE on my windows pc.

I also looked at some documentation on build system, but have no idea how to set it up for c. In class, we do not use cmake, we use Makefile, so not sure how to use the documentation online.

Thanks for any help in pointing me to guides or tutorials for setting up sublime text 3 on linux for C code development. My google search on the topic generated quite a few guides, a very good one on tutorialpoint, but it was for python. https://www.tutorialspoint.com/sublime_text/index.htm

0 Likes

#2

For IDE features like autocomplete and refactoring of names, install the LSP package and set it up with clangd.

As for build systems, I’m not sure what you want to accomplish but the following should work for single-file builds, and for makefile builds I imagine you could just replace the command with a make command instead.

{
  "cmd": ["clang", "-o", "$file_base_name", "$file"],
  "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
  "selector": "source.c",
  "working_dir": "$file_path"
}

Just go to Tools -> Build System -> New Build System to make a new build system, and save it in your user packages folder, like the documentation says.

I don’t know if the LSP and clangd plugins provide linting, but if they don’t you’d want to look up SublimeLinter-clang.

0 Likes

#3

Thanks, the build system did not work initially, but I edited it to include “-lm” in the cmd, since I was using math.h functions.

Thanks also for reference on LSP package, I will try it next.

0 Likes