Getting started with atom


I’m a beginner programmer. I have about average knowledge of C and a few things on Java. So far I’ve only worked with notepad++ to write my C codes. I have a few questions about atom. So first is there a way to use different commands for the cmd terminal ? I use windows and with notepad++ I would usually ricght click my programm name, then open path to cmd, then type gcc <filename.c> <flags such as: -ansi -pedantic -Wall -Wextra> <sometimes -o new_filename> <rarely: -E or -c>. So I installed a package called gcc-make-run. I found out I can use flags -ansi -pedantic -Wall -Wextra as default, which is nice, but what happens is that the program compiles, runs and then I can’t do anything. It promts press any key then closes the cmd. What if I want to rename the .exe file to -o file_numer23 ? So what I want it so be able to remove this “press any key” so that I can write whatever I want in the cmd. Also how to automatically save new files as .c files ? Thanks.

Because you have not actually told Windows to open a command prompt window. All gcc-make-run does is send your file directly to gcc. If you want to open a command prompt window and compile your code inside it, you want to use the process-palette package with a configuration like this:

The /k switch is what tells the new window to stay open and return to the prompt after the command has concluded.

I don’t know that you can. I also don’t think it’s a burden to type .c at the end of your filename.

1 Like

thanks a lot for your tips !

No problem. :slight_smile: Did you get it to work?

yes i managed to create a compile and run command and another one to open the file path in cmd in case i want anything more complex like adding object files or arguments. Is there any way to make the cmd window close after the program is done ? similarly to how gcc-make promts a “press any key to continue…” message and then closes the cmd ?

Also my commands always open the process palette at the bottom when i use them. Can i stop the palette window from showing up every time i run a command ?

Yeah, swap the /k for /c. Take a look at that help page I linked to for all of the options cmd gives you.

Can i stop the palette window from showing up every time i run a command ?

Yes indeed. Just scroll down and you’ll find where you can set it to output to nothing.

so ii tried to do that, but now the cmd window opens then closes immediately. How can i make it so that it only closes at any key press for example ? My command right now is:

start cmd /c “gcc {fileNameExt} -ansi -pedantic -Wall -Wextra && a.exe”

start cmd /c "gcc {fileNameExt} -ansi -pedantic -Wall -Wextra && a.exe && pause" will do that.

Also, the executable name should be dictated by the file name, so you should be able to do start cmd /c "gcc {fileNameExt} -ansi -pedantic -Wall -Wextra && {fileName}.exe && pause".

so now the weird thing that happens is…if the code has no errors then it compiles, runs and prompts the press any key to continue then closes the cmd like intended. However if i tested it with some rubbish code with errors: forgot ; and used a variable without declaring it. Then it just opened the cmd window and closed it right away.

What do you see in the command line window when you run it with /k and there are errors?

ok so now it’s working i don’t get it. I didn’t change anything i just closed atom and restarted my pc today now it works…thanks a lot for your help