Home Download Buy Blog Forum Support

Setting Sublime up for C++

Setting Sublime up for C++

Postby beagle on Mon Oct 19, 2009 5:15 am

I'm curious how I would go about setting up Sublime to compile c++ projects.

I've got mingw as a compiler. Do I have to create a .make file somewhere? Do I change something in the .sublime-project?

Thanks for any suggestions.

--beagle
beagle
 
Posts: 5
Joined: Mon Oct 19, 2009 5:05 am

Re: Setting Sublime up for C++

Postby beagle on Mon Oct 19, 2009 6:46 am

Well I figured it out myself. I've freed myself from the shackles of Visual Studio! Yay!
beagle
 
Posts: 5
Joined: Mon Oct 19, 2009 5:05 am

Re: Setting Sublime up for C++

Postby jps on Mon Oct 19, 2009 8:21 am

Good to hear... if you're working with C/C++, you'll find Alt+O handy to toggle between .h/.cpp files.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Setting Sublime up for C++

Postby Suberus on Wed Oct 21, 2009 4:57 pm

I however would like to know how to do this. I've been fooling around with it for a while, and can't seem to figure it out. I've also done a fair amount of googling and searching of the site and the blog. Any insight that can be provided would be appreciated.
Suberus
 
Posts: 1
Joined: Wed Oct 21, 2009 4:53 pm

Re: Setting Sublime up for C++

Postby jps on Wed Oct 21, 2009 8:48 pm

I'm writing up some documentation for the Build Systems, which should be up some time over the next few days.

Is your project Makefile based, or is it an existing Visual Studio .sln one?
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Setting Sublime up for C++

Postby beagle on Thu Oct 22, 2009 10:47 pm

The way I got it to work was:

You need the following:
* A c++ compiler -- I downloaded mingw, I'm sure there are others.
* A make program -- mingw comes with one.

Sublime tries to call 'make' from the command line when you build your project. The make program mingw comes with is called mingw32-make.exe, so I renamed it to make.exe so that sublime can recognize it.

You also have to add mingw's \bin folder to the windows PATH so that it's visible to sublime.

So now that you're all set up to run make and compile the program, you have to make the makefile. The makefile should be called 'makefile' with no file extension (you might be able to call it something else, but I'm not sure what. Go google it)

If you know how to make makefiles, great. I had been using Visual Studio for years though, and I was incredibly ignorant of how they work. I just knew that they were important for compiling linux stuff from source. Anyways, I googled for makefile tutorial and used this site:
http://www.opussoftware.com/tutorial/TutMakefile.htm

So once you figure that out, just put the makefile in your Sublime project directory and then hit build. If you made the makefile correctly it should work.

I know it's not the best how-to, but maybe it'll help. It might be easier to just compile your stuff from the command line directly and skip the makefile.

If there's an easier way to do this please tell me haha.
beagle
 
Posts: 5
Joined: Mon Oct 19, 2009 5:05 am

Re: Setting Sublime up for C++

Postby parkour86 on Wed Mar 28, 2012 1:16 am

I know this is an old topic but I am having trouble setting this up for the past hour. I am currently having to copy the code from Sublime and pasting it into Visual Studio just to compile it and it's getting really annoying. I tried to follow beagles post but just don't understand how to do this. Is there anyway someone can post a video or maybe do a complete step by step so that I can get this setup? At first I thought purchasing the full version would add the C++ Build System under the tools menu but that was wrong. Thanks.
parkour86
 
Posts: 1
Joined: Wed Mar 28, 2012 1:02 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 14 guests