E
E
E_user2013-12-02 22:57:14
linux
E_user, 2013-12-02 22:57:14

How to set up C compilation in Sublime text under Linux?

Hello,
I wrote a helloworld, I press Tools -> Build and I get

/bin/bash: g++ : command not found
[Finished in 0.0s with exit code 127]
[shell_cmd: g++ "/home/e/code/1.c" -o "/home/e/code/1"]
[ dir: /home/e/code]
[path: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin :/usr/games:/usr/local/games]

If it is practiced at all and is not a perversion.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MintTea, 2013-12-03
@E_user

Sublime builds c files out of the box using g++, i.e. your helloworld is written in c++.
To use the c compiler:
Tools > Build system > New build system...

{
  "cmd" : ["gcc", "$file_name", "-o", "${file_base_name}", "-lm", "-Wall"],
  "selector" : "source.c",
  "shell":false,
  "working_dir" : "$file_path"
}

Then save and use it.
Original .
Well, install gcc, yes :)

A
alternativshik, 2013-12-02
@alternativshik

g++: command not found - it is written after all) There is no compiler in the system. Install gcc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question