I want to compile and run C/C++ programs with sublimetext 2 itself.I dont want to use terminal to do so. What do I need to do for this??I am compeletely new to this so a lot of answers to similar questions did not help me as most of them were for windows.
-
If you just want to compile one file, you just can hit `CTRL+B` for building, and to run hit `CTRL+SHIFT+B`, should work without any configurations. – Eun Feb 21 '15 at 11:44
2 Answers
sublime text 2 build system for C programming language should show you how to setup your build environment. Note: you need gcc etc. installed
Edit: you should although run your programm in a Terminal because SublimeText2 is an Editor and can not recieve user input for your programm. so you better just build it with ST2 and run it in Terminal or you just forget about ST2 and make your own Bash script that manages compiling and runs the programm.

- 1
- 1

- 973
- 9
- 16
I would use sublime text as an editor (which is what IDEs are). Then you'll need to have a Makefile
for your program. And build it by typing make
in a terminal (or by configuring your editor to run that command). BTW, you can type m a k e enter once in your day (and later use up in the same terminal, to reapeat the latest command).
Learning how to write simple Makefile
-s is a reusable skill (see here for "why?"). See this and that and many other examples. Don't attach yourself to one particular editor (even if you may like one more than others; my preference goes to emacs
).
You'll learn a big lot by studying (and improving) the source code of some free software. Look at sourceforge, github, etc.. to find some free software interesting to you, then download its source code, build it, and study it.
The tips and advices I gave here are still valid today, with a recent Ubuntu (e.g. 14.x)
BTW, your question looks like you might be confused; Sublime Text is an editor (perhaps glorified as an IDE). It does not compile anything. The C or C++ compiler on Ubuntu is GCC (using gcc
command for compiling C code, and g++
command for compiling C++ code) or perhaps Clang/LLVM (using clang
command for C code, and clang++
command for C++ code). That compiler is often started by make
, and IDEs on Linux are often running make
-or directly the compiler- command for you. You'll better be able to run these commands yourself.

- 1
- 1

- 223,805
- 18
- 296
- 547