Thursday, May 24, 2018

Programming in C/C++ Within the Sublime Text Editor

Hi all .

In this post, I'll describe setting up a C++ environment using Sublime Text 3 and the GNU compiler. This will allow you to write code in C++ and be able to build and run it all from within the Sublime Text 3 editor.


Things you will need:

Sublime Text 3 - https://www.sublimetext.com/

MinGW -w64 - https://sourceforge.net/projects/mingw-w64/

Build system file - https://gist.githubusercontent.com/sagebind/9039773048a3900fa49a/raw/e465947afb43948b471f739992ce303a92befbf8/MinGW-w64.sublime-build

About 10-15 minutes to complete setup and test. Note: You will probably need to install under an admin account to make sure everything installs correctly.


Steps:

1. Install Sublime Text 3 onto your system.

2. Install MinGW -w64

(Note the location/folder it gets installed to)

3. Set the path variable for MinGW

 Note: If you need help at this step, please see the following link and check the 'Environment Settings' section: http://www.mingw.org/wiki/Getting_Started

4. Copy the following build file and place it within Sublime Text's package folder:
  https://gist.githubusercontent.com/sagebind/9039773048a3900fa49a/raw/e465947afb43948b471f739992ce303a92befbf8/MinGW-w64.sublime-build


Once the above file has been copied to a file and saved within the package folder, you can should be able to build code under Sublime Text.

Write your code in Sublime and then test by going to Tools > Build.



Enjoy!

No comments:

Post a Comment