Home Download Buy Blog Forum Support

Compiling using MinGW

Compiling using MinGW

Postby Daftatt on Wed Jul 04, 2012 12:54 am

So i've scoured the forums to no avail.

My PATH is set to the bin folder in MinGW, my c++ build system in ST2 is as follows:

Code: Select all
"cmd" : ["g++", "$file_name", "-o", "${file_base_name}.exe", "&&", "${file_base_name}.exe"],
"selector" : "source.c",
"working_dir" : "$file_path"

I want to compile the most basic of cpp files:

Code: Select all
#include <iostream>

using namespace std;

int main(void)
   cout << "Hello World" << endl;
   return 0;

I'm using Windows 7 64 bit with the ST2 (non-beta) 64bit.
How do I use a build system to compile and then run this Hello World program.
Posts: 25
Joined: Tue Nov 29, 2011 2:28 am

Re: Compiling using MinGW

Postby thekyz on Tue Jul 10, 2012 7:09 am

With the default sublime c++ build script :

Code: Select all
   "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
   "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
   "working_dir": "${file_path}",
   "selector": "source.c, source.c++",

         "name": "Run",
         "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]

I just hit build (ctrl+B) & then run (shift+ctrl+B) and it works. What are you trying to achieve exactly ? And what is not working for your ?
Posts: 20
Joined: Fri Feb 04, 2011 9:27 am

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 25 guests