Sublime Forum

Output shows nothing

#1

hi. i’m learning c for uni and the teacher wants us to use sublime and cmd as a terminal, but when i type any type of code in the console nothing appears in the output terminal. thats the result when i use tools>build and the same if i click on build results>show build results.

i even tried with the cmd command but i dont really understand what is the executablefile.exe i have to type in and still nothing pops up.

i know this is probably silly but i really don’t understand what im doing wrong. any help is appreciated!

0 Likes

Problem with c and c++ working
#2

ST’s default C build configuration just runs gcc to compile the open file.

The build panel would display compiler output only.

To also execute the file, run ctrl+shift+b and select “C Single File - Run”.

The request to use a terminal however indicates you being expected to run compiled file directly via shell, instead of using ST’s build system for that. It makes sense as build output is designed to display text only. You wouldn’t be able to enter text like in a terminal.

0 Likes

#3

thank you so much!! i did the crtl+shift+b thing and this is what shows up.


is the “[finished in 831ms]” normal or can i remove it in any way?

also, related to this, do you happen to know how to compile a file in cmd with gcc?
i saw online that i should run the command gcc –o [program_name].exe [program_name].c but when i do it just leaves an empty row. my teacher showed us through her screen that when she runs that command cmd tells her where the errors are located (rows and columns) and once she fixed those errors the ST’s output would pop up. she wasnt quite exhaustive with her lesson and left everyone pretty much confused.
(i’m sorry if what i’m saying doesnt make much sense but english isnt my first language)

0 Likes

#4

Actually ST’s build system just calls commands as terminal would. It just calls:

	"shell_cmd": "gcc \"${file}\" -o \"${file_path}/${file_base_name}\"",

To suppress messages "quiet": true can be set in build configuration.

To override default build system and add the setting, you can use OverrideAudit package

  1. Open Command Palette
  2. Call “OverrideAudit: Create Override”
  3. Navigate to C++ package
  4. select C Single File.sublime-build and hiit enter
  5. add `“quiet”: true
  6. save and close new build file

C Single File.sublime-build with quiet setting added to “Run” variant:

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

	"variants":
	[
		{
			"name": "Run",
			"shell_cmd": "gcc \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"",
			"quiet": true
		}
	]
}
0 Likes