How to set up atom for programming in C


So right now I am programming in C. First I set up commands to compile + run and another one to open the file path in cmd using the process-palette package. Works really nice and it does what I want. However I want to learn how to use the following(or similar packages). First is autocomplete-clang. What is the problem here ?

I want to be able to autocomplete library names, such as #include <string.h> and be able to autocmplete functions such as strlen() or pretty much any C function i might need. I managed to find out how to use snippets but it would take a very long time if i had to do this for every function.

Also i heard linter-gcc is good for checking error but i don’t know how to use it. Any tips on using this 2 packages ? or any other good packages for C programming ?


Have you determined whether autocomplete-clang is actually nonfunctional? Just having deprecation messages pop up doesn’t necessarily indicate that the package is broken. It might just be showing cracks that, unless fixed, could cause breaks.

Unfortunately, I don’t know anything about C++, but the linter-gcc package’s documentation doesn’t include any weird installation steps. All you should have to do is download it. Note that both linter and atom-ide-ui will work with it. However, atom-ide-ui has been abandoned by the developers. Work is underway to replace its features with community-owned versions of the same code; for now, the existing atom-ide-ui package is perfectly up to date.


how can i determine whether clang is working or not ? I was expecting it to add some new autocomplete options but it doesn’t ?

Also do you know how linter-gcc works ? Isn’t it supposed to display potential errors ? similarly to how cmd prompts this when i compile a program using the -ansi -pedantic -Wall -Wextra flags ?


If you have the package enabled, you’re in a C++ document, and you don’t see any suggestions, then it’s probably not working, which could be the package’s fault or could just mean that you haven’t installed clang as indicated in the package’s documentation.

Also do you know how linter-gcc works ? Isn’t it supposed to display potential errors ? similarly to how cmd prompts this when i compile a program using the -ansi -pedantic -Wall -Wextra flags ?

That’s what it does, yes. The linter or atom-ide-ui package will create a bottom dock tab that you can look at with all of the warnings and errors.


I think clang is not working at all. With or without it i’m not getting any new autocomplete options. Also idk if it matters but going to packages and clicking on “Emit Precompiled Header” promts this error: “Emiting precompiled header exit with 1 See console for detailed error message”

And with linter the bottom dock is there but it displays no errors ever ?


What happens if you type clang into the command line?

Apparently linter-gcc is outdated enough that a recent update to linter broke it. There’s a temporary fix in that thread.


Could you please guide me through it ? So i opened the cmd and typed: “apm install linter@2.2.0” Now i have the 2.2.0 version instead of the 2.3 linter installed. Error’s still don’t prompt up. What should i do ?


No, because I’ve never been there. All I can do is the exact same Googling you can do. You can try asking users of linter-gcc, looking for another linter, or seeing if ide-cpp works for you.

As for the other issue, that I can still help with guiding. What happens if you type clang in the command line?


What do you mean ? so i should just open the cmd and type “clang” ? does the directory matter or ? If there is nothing i should add and just type clang then nothing happens. It says it doesn’t recognize it as external command.


If clang is installed in a place Atom can get to it, anywhere on your computer will be fine. The point is to see if the command works, not feed it any files.

That’s Windows’ default error message, and indicates that clang is not correctly installed. If you have it on your computer, you need to add its folder to your PATH and then reopen the command line window to check the command (the environment variables of the window won’t update automatically). After that, see if anything’s different in Atom, and if not you should be able to see it by closing and reopening Atom.


ok so now i’ve managed to install clang and typing “clang --version” in cmd shows me this:


With clang installed, after restarting Atom, do you see autocomplete-clang doing anything?


Now it seems to do something. If I type . or :: for example i get a list of constants that i can use, that didn’t appear before. The Emit precompiled header thing is still not working, but i’m not sure what it does anyway. Is there a way for me to see all the available autocomplete options like with “available snippets” or can I edit the autocomplete options and change them ?


The autocomplete options are being generated in real time by clang. There’s no list.


This could do with improving.
Using autocomplete-clang here.
Very common to type ‘else’, then press enter for me.
This results in selecting a suggestion, not fun.
Would be better if the selection wasn’t automatically highlighted and focussed on.
How can I turn off the ‘hit enter to autocorrect’ thing? I’d rather press ‘arrow right’ key first.


If you open the autocomplete-plus settings (under Settings -> Packages), you can change that.


I changed it so that Tab goes to the next suggestion and arrows go up down as usual and only enter can be used for autocmplete. Go to keymap.cson and customize whatever settings you prefer. Mine are:


‘tab’: ‘autocomplete-plus:move-down’ is a good one!
The icing on the cake would be ‘tab’ highlights the first in the list, rather than it being highlighted by default :wink: