Home Download Buy Blog Forum Support

making sublime text compile C/C++ code

making sublime text compile C/C++ code

Postby oronm on Sat Sep 17, 2011 12:37 am

can someone please write the steps for configuring this editor to compile cpp files?
dont quite understand the make cmd procedure. your help will be appreciated.
oronm
 
Posts: 5
Joined: Sat Sep 17, 2011 12:33 am

Re: making sublime text compile C/C++ code

Postby hstimer on Sat Sep 17, 2011 1:54 am

These instructions assume some level of prior knowledge:

1) How to write and test a make file
2) How to write and test a regular expression

Steps
========

1) You need to have a working make file that works correctly from a terminal
2) Next launch ST2 from the command line; if you launch it from a GUI you won't pick up your environment variables
3) Create a file, name it "myproject.sublime-project"; put the following in it, and save.

{
"build_systems":
[
{
"name": "my build",
"cmd": ["make"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
}
]
}

4) Open the project: Project/Open Project...

5) Select your build rule: Tools/Build System/myproject

6) Select build: Tools/Build

7) Build results will appear in a new window on the bottom.

8) F4 should take you to your first error. If not, then you need to fix the regular expression in the project file so that the first grouping selects the file name, and the second selects the line number.
hstimer
 
Posts: 11
Joined: Tue Sep 06, 2011 11:04 am

Re: making sublime text compile C/C++ code

Postby oronm on Sat Sep 17, 2011 6:27 am

i'm sry. i'm fairly new to this - that is why i posted this question. the only compiler i ever used is visual studio for school :/

i'm really interested in dumping vs2010 for ST2. can you be more specific? (the noob's guide to cpp with ST2)
oronm
 
Posts: 5
Joined: Sat Sep 17, 2011 12:33 am

Re: making sublime text compile C/C++ code

Postby clockwork on Sat Sep 17, 2011 11:34 am

I would be interested in this guide too.
clockwork
 
Posts: 4
Joined: Sat Sep 17, 2011 11:32 am

Re: making sublime text compile C/C++ code

Postby hstimer on Sat Sep 17, 2011 11:56 am

As cool as sublime is, it isn't an ide. It is really for people who are comfortable using a command line for development. I suggest that you spend some time learning about:

* shell use and scripting
* regular expressions
* makefiles

You can use sublime as your editor, but you will need command line development skills to go with it.
hstimer
 
Posts: 11
Joined: Tue Sep 06, 2011 11:04 am

Re: making sublime text compile C/C++ code

Postby oronm on Sat Sep 17, 2011 4:51 pm

knowledge is always helpful in every aspect of life :)

i thought there is a way to just link a compiler to sublime so i could code->build->debug.
are you telling me that is impossible without mastering shell use and scripting\ regular expressions\ makefiles?
oronm
 
Posts: 5
Joined: Sat Sep 17, 2011 12:33 am

Re: making sublime text compile C/C++ code

Postby yoshgoodman on Sun Oct 02, 2011 3:12 pm

yoshgoodman
 
Posts: 1
Joined: Sun Oct 02, 2011 3:09 pm

Re: making sublime text compile C/C++ code

Postby th3ant on Wed Oct 12, 2011 6:22 pm

Any other SIMPLE Guides to make a makefile to compile a c++ program?

I'm only persisting because I love sublime's GUI, and I don't want to go back to something like Dev-C++...
SIMPLE Guides anyone?
th3ant
 
Posts: 1
Joined: Wed Oct 12, 2011 6:10 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 20 guests

cron